Skip to contentSkip to conversation

SUNRPC: Fix an error code in gss_alloc_msg()

PATCH New Dan Carpenter 1 participant 1 message May 3, 2019

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 SUNRPC: Fix an error code in gss_alloc_msg()

If kstrdup_const() then this function returns zero (success) but it should return -ENOMEM.

Fixes ac83228a7101 ("SUNRPC: Use namespace of listening daemon in the client AUTH_GSS upcall")
---
 net/sunrpc/auth_gss/auth_gss.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
net/sunrpc/auth_gss/auth_gss.c +3 -1
index b2cbc83d39c7..06fe17c2aea1 100644
@@ -553,8 +553,10 @@ gss_alloc_msg(struct gss_auth *gss_auth,
 	gss_msg->auth = gss_auth;
 	if (service_name) {
 		gss_msg->service_name = kstrdup_const(service_name, GFP_NOFS);
-		if (!gss_msg->service_name)
+		if (!gss_msg->service_name) {
+			err = -ENOMEM;
 			goto err_put_pipe_version;
+		}
 	}
 	return gss_msg;
 err_put_pipe_version:
Signature · 1 line
2.18.0