summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaksim Salau <maksim.salau@gmail.com>2017-04-22 20:03:06 +0300
committerKalle Valo <kvalo@codeaurora.org>2017-04-26 12:01:10 +0300
commit2f6ae79cb04bb7f9b4be3f1c32b6fda35bf976bc (patch)
tree2f661692be55ae4659fc7c7e5b79371d43e79d99
parentbea35f90dbb13c08389993847019b44047862952 (diff)
downloadlinux-2f6ae79cb04bb7f9b4be3f1c32b6fda35bf976bc.tar.gz
linux-2f6ae79cb04bb7f9b4be3f1c32b6fda35bf976bc.tar.bz2
linux-2f6ae79cb04bb7f9b4be3f1c32b6fda35bf976bc.zip
orinoco_usb: Fix buffer on stack
Allocate buffer on HEAP instead of STACK for a local variable that is to be sent using usb_control_msg(). Signed-off-by: Maksim Salau <maksim.salau@gmail.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
-rw-r--r--drivers/net/wireless/intersil/orinoco/orinoco_usb.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/drivers/net/wireless/intersil/orinoco/orinoco_usb.c b/drivers/net/wireless/intersil/orinoco/orinoco_usb.c
index 98e1380b9917..132f5fbda58b 100644
--- a/drivers/net/wireless/intersil/orinoco/orinoco_usb.c
+++ b/drivers/net/wireless/intersil/orinoco/orinoco_usb.c
@@ -769,18 +769,31 @@ static int ezusb_submit_in_urb(struct ezusb_priv *upriv)
static inline int ezusb_8051_cpucs(struct ezusb_priv *upriv, int reset)
{
- u8 res_val = reset; /* avoid argument promotion */
+ int ret;
+ u8 *res_val = NULL;
if (!upriv->udev) {
err("%s: !upriv->udev", __func__);
return -EFAULT;
}
- return usb_control_msg(upriv->udev,
+
+ res_val = kmalloc(sizeof(*res_val), GFP_KERNEL);
+
+ if (!res_val)
+ return -ENOMEM;
+
+ *res_val = reset; /* avoid argument promotion */
+
+ ret = usb_control_msg(upriv->udev,
usb_sndctrlpipe(upriv->udev, 0),
EZUSB_REQUEST_FW_TRANS,
USB_TYPE_VENDOR | USB_RECIP_DEVICE |
- USB_DIR_OUT, EZUSB_CPUCS_REG, 0, &res_val,
- sizeof(res_val), DEF_TIMEOUT);
+ USB_DIR_OUT, EZUSB_CPUCS_REG, 0, res_val,
+ sizeof(*res_val), DEF_TIMEOUT);
+
+ kfree(res_val);
+
+ return ret;
}
static int ezusb_firmware_download(struct ezusb_priv *upriv,