aboutsummaryrefslogtreecommitdiffstats
path: root/lib/digsig.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/digsig.c')
-rw-r--r--lib/digsig.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/digsig.c b/lib/digsig.c
index b67e82c024b..286d558033e 100644
--- a/lib/digsig.c
+++ b/lib/digsig.c
@@ -109,9 +109,13 @@ static int digsig_verify_rsa(struct key *key,
109 datap = pkh->mpi; 109 datap = pkh->mpi;
110 endp = ukp->data + ukp->datalen; 110 endp = ukp->data + ukp->datalen;
111 111
112 err = -ENOMEM;
113
112 for (i = 0; i < pkh->nmpi; i++) { 114 for (i = 0; i < pkh->nmpi; i++) {
113 unsigned int remaining = endp - datap; 115 unsigned int remaining = endp - datap;
114 pkey[i] = mpi_read_from_buffer(datap, &remaining); 116 pkey[i] = mpi_read_from_buffer(datap, &remaining);
117 if (!pkey[i])
118 goto err;
115 datap += remaining; 119 datap += remaining;
116 } 120 }
117 121
@@ -168,8 +172,8 @@ err:
168 mpi_free(res); 172 mpi_free(res);
169 kfree(out1); 173 kfree(out1);
170 kfree(out2); 174 kfree(out2);
171 mpi_free(pkey[0]); 175 while (--i >= 0)
172 mpi_free(pkey[1]); 176 mpi_free(pkey[i]);
173err1: 177err1:
174 up_read(&key->sem); 178 up_read(&key->sem);
175 179