stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* FAILED: patch "[PATCH] [media] dvb-usb-firmware: don't do DMA on stack" failed to apply to 4.11-stable tree
@ 2017-05-23 12:33 gregkh
  2017-05-23 13:28 ` Brüns, Stefan
  0 siblings, 1 reply; 3+ messages in thread
From: gregkh @ 2017-05-23 12:33 UTC (permalink / raw)
  To: stefan.bruens, mchehab; +Cc: stable


The patch below does not apply to the 4.11-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable@vger.kernel.org>.

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

>From f9fa0f2bebaa629aff839b7b992298b1fce453d2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20Br=C3=BCns?= <stefan.bruens@rwth-aachen.de>
Date: Sun, 12 Feb 2017 13:02:13 -0200
Subject: [PATCH] [media] dvb-usb-firmware: don't do DMA on stack
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The buffer allocation for the firmware data was changed in
commit 43fab9793c1f ("[media] dvb-usb: don't use stack for firmware load")
but the same applies for the reset value.

Fixes: 43fab9793c1f ("[media] dvb-usb: don't use stack for firmware load")
Cc: stable@vger.kernel.org
Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>

diff --git a/drivers/media/usb/dvb-usb/dvb-usb-firmware.c b/drivers/media/usb/dvb-usb/dvb-usb-firmware.c
index ab9866024ec7..04033efe7ad5 100644
--- a/drivers/media/usb/dvb-usb/dvb-usb-firmware.c
+++ b/drivers/media/usb/dvb-usb/dvb-usb-firmware.c
@@ -36,16 +36,18 @@ static int usb_cypress_writemem(struct usb_device *udev,u16 addr,u8 *data, u8 le
 int usb_cypress_load_firmware(struct usb_device *udev, const struct firmware *fw, int type)
 {
 	struct hexline *hx;
-	u8 reset;
-	int ret,pos=0;
+	u8 *buf;
+	int ret, pos = 0;
+	u16 cpu_cs_register = cypress[type].cpu_cs_register;
 
-	hx = kmalloc(sizeof(*hx), GFP_KERNEL);
-	if (!hx)
+	buf = kmalloc(sizeof(*hx), GFP_KERNEL);
+	if (!buf)
 		return -ENOMEM;
+	hx = (struct hexline *)buf;
 
 	/* stop the CPU */
-	reset = 1;
-	if ((ret = usb_cypress_writemem(udev,cypress[type].cpu_cs_register,&reset,1)) != 1)
+	buf[0] = 1;
+	if (usb_cypress_writemem(udev, cpu_cs_register, buf, 1) != 1)
 		err("could not stop the USB controller CPU.");
 
 	while ((ret = dvb_usb_get_hexline(fw, hx, &pos)) > 0) {
@@ -61,21 +63,21 @@ int usb_cypress_load_firmware(struct usb_device *udev, const struct firmware *fw
 	}
 	if (ret < 0) {
 		err("firmware download failed at %d with %d",pos,ret);
-		kfree(hx);
+		kfree(buf);
 		return ret;
 	}
 
 	if (ret == 0) {
 		/* restart the CPU */
-		reset = 0;
-		if (ret || usb_cypress_writemem(udev,cypress[type].cpu_cs_register,&reset,1) != 1) {
+		buf[0] = 0;
+		if (usb_cypress_writemem(udev, cpu_cs_register, buf, 1) != 1) {
 			err("could not restart the USB controller CPU.");
 			ret = -EINVAL;
 		}
 	} else
 		ret = -EIO;
 
-	kfree(hx);
+	kfree(buf);
 
 	return ret;
 }

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: FAILED: patch "[PATCH] [media] dvb-usb-firmware: don't do DMA on stack" failed to apply to 4.11-stable tree
  2017-05-23 12:33 FAILED: patch "[PATCH] [media] dvb-usb-firmware: don't do DMA on stack" failed to apply to 4.11-stable tree gregkh
@ 2017-05-23 13:28 ` Brüns, Stefan
  2017-05-23 13:54   ` gregkh
  0 siblings, 1 reply; 3+ messages in thread
From: Brüns, Stefan @ 2017-05-23 13:28 UTC (permalink / raw)
  To: stable@vger.kernel.org
  Cc: gregkh@linuxfoundation.org, mchehab@s-opensource.com

On Dienstag, 23. Mai 2017 14:33:55 CEST gregkh@linuxfoundation.org wrote:
> The patch below does not apply to the 4.11-stable tree.
> If someone wants it applied there, or to any other stable or longterm
> tree, then please email the backport, including the original git commit
> id to <stable@vger.kernel.org>.

Please apply this:
67b0503db9c29b04eadfeede6bebbfe5ddad94ef ("[media] dvb-usb-firmware: don't do 
DMA on stack")

on top of commit:
43fab9793c1f44e665b4f98035a14942edf03ddc ("[media] dvb-usb: don't use stack 
for firmware load")

(both from mainline)

Kind regards,

Stefan

> ------------------ original commit in Linus's tree ------------------
> 
> From f9fa0f2bebaa629aff839b7b992298b1fce453d2 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Stefan=20Br=C3=BCns?= <stefan.bruens@rwth-aachen.de>
> Date: Sun, 12 Feb 2017 13:02:13 -0200
> Subject: [PATCH] [media] dvb-usb-firmware: don't do DMA on stack
> MIME-Version: 1.0
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: 8bit
> 
> The buffer allocation for the firmware data was changed in
> commit 43fab9793c1f ("[media] dvb-usb: don't use stack for firmware load")
> but the same applies for the reset value.
> 
> Fixes: 43fab9793c1f ("[media] dvb-usb: don't use stack for firmware load")
> Cc: stable@vger.kernel.org
> Signed-off-by: Stefan Br�ns <stefan.bruens@rwth-aachen.de>
> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
> 
> diff --git a/drivers/media/usb/dvb-usb/dvb-usb-firmware.c
> b/drivers/media/usb/dvb-usb/dvb-usb-firmware.c index
> ab9866024ec7..04033efe7ad5 100644
> --- a/drivers/media/usb/dvb-usb/dvb-usb-firmware.c
> +++ b/drivers/media/usb/dvb-usb/dvb-usb-firmware.c
> @@ -36,16 +36,18 @@ static int usb_cypress_writemem(struct usb_device
> *udev,u16 addr,u8 *data, u8 le int usb_cypress_load_firmware(struct
> usb_device *udev, const struct firmware *fw, int type) {
>  	struct hexline *hx;
> -	u8 reset;
> -	int ret,pos=0;
> +	u8 *buf;
> +	int ret, pos = 0;
> +	u16 cpu_cs_register = cypress[type].cpu_cs_register;
> 
> -	hx = kmalloc(sizeof(*hx), GFP_KERNEL);
> -	if (!hx)
> +	buf = kmalloc(sizeof(*hx), GFP_KERNEL);
> +	if (!buf)
>  		return -ENOMEM;
> +	hx = (struct hexline *)buf;
> 
>  	/* stop the CPU */
> -	reset = 1;
> -	if ((ret =
> usb_cypress_writemem(udev,cypress[type].cpu_cs_register,&reset,1)) != 1)
> +	buf[0] = 1;
> +	if (usb_cypress_writemem(udev, cpu_cs_register, buf, 1) != 1)
>  		err("could not stop the USB controller CPU.");
> 
>  	while ((ret = dvb_usb_get_hexline(fw, hx, &pos)) > 0) {
> @@ -61,21 +63,21 @@ int usb_cypress_load_firmware(struct usb_device *udev,
> const struct firmware *fw }
>  	if (ret < 0) {
>  		err("firmware download failed at %d with %d",pos,ret);
> -		kfree(hx);
> +		kfree(buf);
>  		return ret;
>  	}
> 
>  	if (ret == 0) {
>  		/* restart the CPU */
> -		reset = 0;
> -		if (ret ||
> usb_cypress_writemem(udev,cypress[type].cpu_cs_register,&reset,1) != 1) {
> +		buf[0] = 0;
> +		if (usb_cypress_writemem(udev, cpu_cs_register, buf, 1) != 1) {
>  			err("could not restart the USB controller CPU.");
>  			ret = -EINVAL;
>  		}
>  	} else
>  		ret = -EIO;
> 
> -	kfree(hx);
> +	kfree(buf);
> 
>  	return ret;
>  }

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: FAILED: patch "[PATCH] [media] dvb-usb-firmware: don't do DMA on stack" failed to apply to 4.11-stable tree
  2017-05-23 13:28 ` Brüns, Stefan
@ 2017-05-23 13:54   ` gregkh
  0 siblings, 0 replies; 3+ messages in thread
From: gregkh @ 2017-05-23 13:54 UTC (permalink / raw)
  To: Brüns, Stefan; +Cc: stable@vger.kernel.org, mchehab@s-opensource.com

On Tue, May 23, 2017 at 01:28:07PM +0000, Br�ns, Stefan wrote:
> On Dienstag, 23. Mai 2017 14:33:55 CEST gregkh@linuxfoundation.org wrote:
> > The patch below does not apply to the 4.11-stable tree.
> > If someone wants it applied there, or to any other stable or longterm
> > tree, then please email the backport, including the original git commit
> > id to <stable@vger.kernel.org>.
> 
> Please apply this:
> 67b0503db9c29b04eadfeede6bebbfe5ddad94ef ("[media] dvb-usb-firmware: don't do 
> DMA on stack")

Wait, that's a different commit id!  That's already in 4.11.

> 
> on top of commit:
> 43fab9793c1f44e665b4f98035a14942edf03ddc ("[media] dvb-usb: don't use stack 
> for firmware load")

As is this one.

So I guess there's nothing to do here, right?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-05-23 13:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-23 12:33 FAILED: patch "[PATCH] [media] dvb-usb-firmware: don't do DMA on stack" failed to apply to 4.11-stable tree gregkh
2017-05-23 13:28 ` Brüns, Stefan
2017-05-23 13:54   ` gregkh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).