lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6de2396d-eaa4-5cb4-9a1d-f253503bcf48@xs4all.nl>
Date:   Wed, 9 Oct 2019 14:42:04 +0200
From:   Hans Verkuil <hverkuil@...all.nl>
To:     Navid Emamdoost <navid.emamdoost@...il.com>
Cc:     emamd001@....edu, smccaman@....edu, kjlu@....edu,
        Mauro Carvalho Chehab <mchehab@...nel.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        Richard Fontana <rfontana@...hat.com>,
        Kate Stewart <kstewart@...uxfoundation.org>,
        linux-media@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] media: usb: fix memory leak in af9005_identify_state

On 9/14/19 1:55 AM, Navid Emamdoost wrote:
> In af9005_identify_state when returning -EIO the allocated buffer should
> be released.
> 
> Signed-off-by: Navid Emamdoost <navid.emamdoost@...il.com>
> ---
>  drivers/media/usb/dvb-usb/af9005.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/media/usb/dvb-usb/af9005.c b/drivers/media/usb/dvb-usb/af9005.c
> index 02697d86e8c1..aee500beaab6 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
> +	else {
> +		kfree(buf);
>  		return -EIO;
> +	}

Why not just set ret = -EIO; here?

You only need to add a

	if (!ret)
>  	deb_info("Identify state cold = %d\n", *cold);

before this line.

So this becomes:

        else
                ret = -EIO;
        if (!ret)
                deb_info("Identify state cold = %d\n", *cold);

Regards,

	Hans

>  
>  err:
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ