Skip to content

Commit

Permalink
crypto: asymmetric_keys - set error code on failure
Browse files Browse the repository at this point in the history
In function public_key_verify_signature(), returns variable ret on
error paths. When the call to kmalloc() fails, the value of ret is 0,
and it is not set to an errno before returning. This patch fixes the
bug.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188891

Signed-off-by: Pan Bian <[email protected]>
Signed-off-by: David Howells <[email protected]>
Signed-off-by: Herbert Xu <[email protected]>
  • Loading branch information
SinkFinder authored and herbertx committed Dec 14, 2016
1 parent 04b46fb commit fbb7263
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions crypto/asymmetric_keys/public_key.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ int public_key_verify_signature(const struct public_key *pkey,
if (ret)
goto error_free_req;

ret = -ENOMEM;
outlen = crypto_akcipher_maxsize(tfm);
output = kmalloc(outlen, GFP_KERNEL);
if (!output)
Expand Down

0 comments on commit fbb7263

Please sign in to comment.