mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2024-12-29 17:23:36 +00:00
lib/digsig: checks for NULL return value
mpi_read_from_buffer() return value must not be NULL. Signed-off-by: Dmitry Kasatkin <dmitry.kasatkin@intel.com> Reviewed-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> Signed-off-by: James Morris <jmorris@namei.org>
This commit is contained in:
parent
43b2c0aeaa
commit
86f8bedc9e
@ -109,9 +109,13 @@ static int digsig_verify_rsa(struct key *key,
|
||||
datap = pkh->mpi;
|
||||
endp = ukp->data + ukp->datalen;
|
||||
|
||||
err = -ENOMEM;
|
||||
|
||||
for (i = 0; i < pkh->nmpi; i++) {
|
||||
unsigned int remaining = endp - datap;
|
||||
pkey[i] = mpi_read_from_buffer(datap, &remaining);
|
||||
if (!pkey[i])
|
||||
goto err;
|
||||
datap += remaining;
|
||||
}
|
||||
|
||||
@ -168,8 +172,8 @@ static int digsig_verify_rsa(struct key *key,
|
||||
mpi_free(res);
|
||||
kfree(out1);
|
||||
kfree(out2);
|
||||
mpi_free(pkey[0]);
|
||||
mpi_free(pkey[1]);
|
||||
while (--i >= 0)
|
||||
mpi_free(pkey[i]);
|
||||
err1:
|
||||
up_read(&key->sem);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user