提交 86f8bedc 编写于 作者: D Dmitry Kasatkin 提交者: James Morris

lib/digsig: checks for NULL return value

mpi_read_from_buffer() return value must not be NULL.
Signed-off-by: NDmitry Kasatkin <dmitry.kasatkin@intel.com>
Reviewed-by: NTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: NJames Morris <jmorris@namei.org>
上级 43b2c0ae
...@@ -109,9 +109,13 @@ static int digsig_verify_rsa(struct key *key, ...@@ -109,9 +109,13 @@ static int digsig_verify_rsa(struct key *key,
datap = pkh->mpi; datap = pkh->mpi;
endp = ukp->data + ukp->datalen; endp = ukp->data + ukp->datalen;
err = -ENOMEM;
for (i = 0; i < pkh->nmpi; i++) { for (i = 0; i < pkh->nmpi; i++) {
unsigned int remaining = endp - datap; unsigned int remaining = endp - datap;
pkey[i] = mpi_read_from_buffer(datap, &remaining); pkey[i] = mpi_read_from_buffer(datap, &remaining);
if (!pkey[i])
goto err;
datap += remaining; datap += remaining;
} }
...@@ -168,8 +172,8 @@ static int digsig_verify_rsa(struct key *key, ...@@ -168,8 +172,8 @@ static int digsig_verify_rsa(struct key *key,
mpi_free(res); mpi_free(res);
kfree(out1); kfree(out1);
kfree(out2); kfree(out2);
mpi_free(pkey[0]); while (--i >= 0)
mpi_free(pkey[1]); mpi_free(pkey[i]);
err1: err1:
up_read(&key->sem); up_read(&key->sem);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册