SUNRPC: Fix an error code in gss_alloc_msg()
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 3 May 2019 12:30:09 +0000 (15:30 +0300)
committerAnna Schumaker <Anna.Schumaker@Netapp.com>
Thu, 9 May 2019 20:26:56 +0000 (16:26 -0400)
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")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
net/sunrpc/auth_gss/auth_gss.c

index b2cbc83d39c775cea6b246bf62d9773536d1f090..06fe17c2aea1fd6ee06071e50a6659bb3343094c 100644 (file)
@@ -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: