mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] media: dvb: Fix memory leak in af9005_identify_state
@ 2019-10-27 22:24 Navid Emamdoost
  2019-10-28  9:50 ` Sean Young
  0 siblings, 1 reply; 2+ messages in thread
From: Navid Emamdoost @ 2019-10-27 22:24 UTC (permalink / raw)
  Cc: emamd001, kjlu, smccaman, Navid Emamdoost, Mauro Carvalho Chehab,
	Allison Randal, Thomas Gleixner, Kate Stewart, Richard Fontana,
	linux-media, linux-kernel

In the implementation of af9005_identify_state() there is a memory leak
when checking the reply of af9005_boot_packet(). Go to error path to
release buf.

Fixes: af4e067e1dcf ("V4L/DVB (5625): Add support for the AF9005 demodulator from Afatech")
Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
---
 drivers/media/usb/dvb-usb/af9005.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/media/usb/dvb-usb/af9005.c b/drivers/media/usb/dvb-usb/af9005.c
index 02697d86e8c1..cfaf630be4d8 100644
--- a/drivers/media/usb/dvb-usb/af9005.c
+++ b/drivers/media/usb/dvb-usb/af9005.c
@@ -975,8 +975,10 @@ static int af9005_identify_state(struct usb_device *udev,
 		*cold = 1;
 	else if (reply == 0x02)
 		*cold = 0;
-	else
-		return -EIO;
+	else {
+		ret = -EIO;
+		goto err;
+	}
 	deb_info("Identify state cold = %d\n", *cold);
 
 err:
-- 
2.17.1


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

* Re: [PATCH] media: dvb: Fix memory leak in af9005_identify_state
  2019-10-27 22:24 [PATCH] media: dvb: Fix memory leak in af9005_identify_state Navid Emamdoost
@ 2019-10-28  9:50 ` Sean Young
  0 siblings, 0 replies; 2+ messages in thread
From: Sean Young @ 2019-10-28  9:50 UTC (permalink / raw)
  To: Navid Emamdoost
  Cc: emamd001, kjlu, smccaman, Mauro Carvalho Chehab, Allison Randal,
	Thomas Gleixner, Kate Stewart, Richard Fontana, linux-media,
	linux-kernel

On Sun, Oct 27, 2019 at 05:24:35PM -0500, Navid Emamdoost wrote:
> In the implementation of af9005_identify_state() there is a memory leak
> when checking the reply of af9005_boot_packet(). Go to error path to
> release buf.
> 
> Fixes: af4e067e1dcf ("V4L/DVB (5625): Add support for the AF9005 demodulator from Afatech")
> Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>

Thank you for the patch.

Unfortunately a similar patch is already merged:

https://git.linuxtv.org/media_tree.git/commit/?id=2289adbfa559050d2a38bcd9caac1c18b800e928

Sean

> ---
>  drivers/media/usb/dvb-usb/af9005.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/media/usb/dvb-usb/af9005.c b/drivers/media/usb/dvb-usb/af9005.c
> index 02697d86e8c1..cfaf630be4d8 100644
> --- a/drivers/media/usb/dvb-usb/af9005.c
> +++ b/drivers/media/usb/dvb-usb/af9005.c
> @@ -975,8 +975,10 @@ static int af9005_identify_state(struct usb_device *udev,
>  		*cold = 1;
>  	else if (reply == 0x02)
>  		*cold = 0;
> -	else
> -		return -EIO;
> +	else {
> +		ret = -EIO;
> +		goto err;
> +	}
>  	deb_info("Identify state cold = %d\n", *cold);
>  
>  err:
> -- 
> 2.17.1

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

end of thread, other threads:[~2019-10-28  9:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-27 22:24 [PATCH] media: dvb: Fix memory leak in af9005_identify_state Navid Emamdoost
2019-10-28  9:50 ` Sean Young

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®