Skip to content

Commit

Permalink
SUNRPC: Fix up an error return value in gss_import_sec_context_kerber…
Browse files Browse the repository at this point in the history
…os()

If the context allocation fails, the function currently returns a random
error code, since the variable 'p' still points to a valid memory location.

Ensure that it returns ENOMEM...

Cc: stable@kernel.org
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
  • Loading branch information
Trond Myklebust authored and Trond Myklebust committed Dec 18, 2009
1 parent 5563935 commit 14ace02
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion net/sunrpc/auth_gss/gss_krb5_mech.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,10 @@ gss_import_sec_context_kerberos(const void *p,
struct krb5_ctx *ctx;
int tmp;

if (!(ctx = kzalloc(sizeof(*ctx), GFP_NOFS)))
if (!(ctx = kzalloc(sizeof(*ctx), GFP_NOFS))) {
p = ERR_PTR(-ENOMEM);
goto out_err;
}

p = simple_get_bytes(p, end, &ctx->initiate, sizeof(ctx->initiate));
if (IS_ERR(p))
Expand Down

0 comments on commit 14ace02

Please sign in to comment.