Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 14ace024 authored by Trond Myklebust's avatar Trond Myklebust
Browse files

SUNRPC: Fix up an error return value in gss_import_sec_context_kerberos()



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: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent 55639353
Loading
Loading
Loading
Loading
+3 −1
Original line number Original line Diff line number Diff line
@@ -131,8 +131,10 @@ gss_import_sec_context_kerberos(const void *p,
	struct	krb5_ctx *ctx;
	struct	krb5_ctx *ctx;
	int tmp;
	int tmp;


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


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