summary refs log tree commit diff
diff options
context:
space:
mode:
authorWei Yongjun <weiyongjun1@huawei.com>2016-10-19 13:19:02 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-10-19 15:28:29 +0200
commit1ee1710cd6bbf49853688e97d6e1d98b48f28586 (patch)
tree98e70edfb6f72b559b49203f87c27eca477e0e9c
parent733cbe069835d081c9e4bbfabb25597da472359c (diff)
downloadlinux-1ee1710cd6bbf49853688e97d6e1d98b48f28586.tar.gz
wusb: fix error return code in wusb_prf()
Fix to return error code -ENOMEM from the kmalloc() error handling
case instead of 0, as done elsewhere in this function.

Fixes: a19b882c07a6 ("wusb: Stop using the stack for sg crypto scratch space")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/usb/wusbcore/crypto.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/usb/wusbcore/crypto.c b/drivers/usb/wusbcore/crypto.c
index de089f3a82f3..79451f7ef1b7 100644
--- a/drivers/usb/wusbcore/crypto.c
+++ b/drivers/usb/wusbcore/crypto.c
@@ -339,8 +339,10 @@ ssize_t wusb_prf(void *out, size_t out_size,
 		goto error_setkey_aes;
 	}
 	scratch = kmalloc(sizeof(*scratch), GFP_KERNEL);
-	if (!scratch)
+	if (!scratch) {
+		result = -ENOMEM;
 		goto error_alloc_scratch;
+	}
 
 	for (bitr = 0; bitr < (len + 63) / 64; bitr++) {
 		sfn_le = cpu_to_le64(sfn++);