49 lines
1.7 KiB
Diff
49 lines
1.7 KiB
Diff
From: Ben Hutchings <ben@decadent.org.uk>
|
|
Subject: [media] dvb-usb: Don't use stack for reset either
|
|
Date: Wed, 01 Mar 2017 15:39:17 +0000
|
|
Bug-Debian: https://bugs.debian.org/853894
|
|
|
|
Commit 43fab9793c1f ("[media] dvb-usb: don't use stack for firmware
|
|
load") introduced a heap buffer for the firmware writes, but we need
|
|
to do the same for the register writes to reset the DVB device's
|
|
processor.
|
|
|
|
Cc: stable@vger.kernel.org # 4.9+
|
|
Fixes: 43fab9793c1f ("[media] dvb-usb: don't use stack for firmware load")
|
|
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
|
|
---
|
|
--- a/drivers/media/usb/dvb-usb/dvb-usb-firmware.c
|
|
+++ b/drivers/media/usb/dvb-usb/dvb-usb-firmware.c
|
|
@@ -36,16 +36,17 @@ static int usb_cypress_writemem(struct u
|
|
int usb_cypress_load_firmware(struct usb_device *udev, const struct firmware *fw, int type)
|
|
{
|
|
struct hexline *hx;
|
|
- u8 reset;
|
|
+ u8 *reset;
|
|
int ret,pos=0;
|
|
|
|
hx = kmalloc(sizeof(*hx), GFP_KERNEL);
|
|
if (!hx)
|
|
return -ENOMEM;
|
|
+ reset = (u8 *)hx;
|
|
|
|
/* stop the CPU */
|
|
- reset = 1;
|
|
- if ((ret = usb_cypress_writemem(udev,cypress[type].cpu_cs_register,&reset,1)) != 1)
|
|
+ *reset = 1;
|
|
+ if ((ret = usb_cypress_writemem(udev, cypress[type].cpu_cs_register, reset, 1)) != 1)
|
|
err("could not stop the USB controller CPU.");
|
|
|
|
while ((ret = dvb_usb_get_hexline(fw, hx, &pos)) > 0) {
|
|
@@ -68,8 +69,8 @@ int usb_cypress_load_firmware(struct usb
|
|
|
|
if (ret == 0) {
|
|
/* restart the CPU */
|
|
- reset = 0;
|
|
- if (ret || usb_cypress_writemem(udev,cypress[type].cpu_cs_register,&reset,1) != 1) {
|
|
+ *reset = 0;
|
|
+ if (ret || usb_cypress_writemem(udev,cypress[type].cpu_cs_register, reset, 1) != 1) {
|
|
err("could not restart the USB controller CPU.");
|
|
ret = -EINVAL;
|
|
}
|