aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Lutomirski <luto@kernel.org>2016-12-13 21:50:13 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-01-19 14:18:01 -0500
commit88d3670a1de4246cd40dfacdc21289b313caf5ed (patch)
tree7a137776da737663fdefe6002a0a16957315004d
parent99ff99b830c1d70d0c6ec50c64588d9bd8bd5d05 (diff)
wusbcore: Fix one more crypto-on-the-stack bug
commit 620f1a632ebcc9811c2f8009ba52297c7006f805 upstream. The driver put a constant buffer of all zeros on the stack and pointed a scatterlist entry at it. This doesn't work with virtual stacks. Use ZERO_PAGE instead. Reported-by: Eric Biggers <ebiggers3@gmail.com> Signed-off-by: Andy Lutomirski <luto@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/usb/wusbcore/crypto.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/usb/wusbcore/crypto.c b/drivers/usb/wusbcore/crypto.c
index 79451f7ef1b7..062c205f0046 100644
--- a/drivers/usb/wusbcore/crypto.c
+++ b/drivers/usb/wusbcore/crypto.c
@@ -216,7 +216,6 @@ static int wusb_ccm_mac(struct crypto_skcipher *tfm_cbc,
216 struct scatterlist sg[4], sg_dst; 216 struct scatterlist sg[4], sg_dst;
217 void *dst_buf; 217 void *dst_buf;
218 size_t dst_size; 218 size_t dst_size;
219 const u8 bzero[16] = { 0 };
220 u8 iv[crypto_skcipher_ivsize(tfm_cbc)]; 219 u8 iv[crypto_skcipher_ivsize(tfm_cbc)];
221 size_t zero_padding; 220 size_t zero_padding;
222 221
@@ -261,7 +260,7 @@ static int wusb_ccm_mac(struct crypto_skcipher *tfm_cbc,
261 sg_set_buf(&sg[1], &scratch->b1, sizeof(scratch->b1)); 260 sg_set_buf(&sg[1], &scratch->b1, sizeof(scratch->b1));
262 sg_set_buf(&sg[2], b, blen); 261 sg_set_buf(&sg[2], b, blen);
263 /* 0 if well behaved :) */ 262 /* 0 if well behaved :) */
264 sg_set_buf(&sg[3], bzero, zero_padding); 263 sg_set_page(&sg[3], ZERO_PAGE(0), zero_padding, 0);
265 sg_init_one(&sg_dst, dst_buf, dst_size); 264 sg_init_one(&sg_dst, dst_buf, dst_size);
266 265
267 skcipher_request_set_tfm(req, tfm_cbc); 266 skcipher_request_set_tfm(req, tfm_cbc);