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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4D91C1EB.5060604@ru.mvista.com>
Date:	Tue, 29 Mar 2011 15:26:35 +0400
From:	Sergei Shtylyov <sshtylyov@...sta.com>
To:	Steven Hardy <shardy@...hat.com>
CC:	Greg KH <gregkh@...e.de>, Aristeu Rozanski <aris@...hat.com>,
	mjg@...hat.com, linux-usb@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [GIT PATCH 2/3 (2nd draft)] Resend : Fix memory leak in qcserial
 driver

Hello.

On 29-03-2011 2:16, Steven Hardy wrote:

> Second draft of patch #2, this addresses the review comments made by Aristeu Rozanski, now usb_set_serial_data() is only called when we are not returning -ENODEV

    Such comments should be put under --- tearline (which should appear under 
your signoff). Otherwise Greg will have to hand edit them out of your patch.

> Original description:

    Omit that please.

> Don't assign serial->private when doing the kzalloc or serial->private ends up pointing to freed memory in the event we return -ENODEV, instead call usb_set_serial_data(serial, data) at the end of the function, and only have one return-point.

    Still not properly wrapped.

> Signed-off-by: Steve Hardy<shardy@...hat.com>


> diff --git a/drivers/usb/serial/qcserial.c b/drivers/usb/serial/qcserial.c
> index 6e3b933..b9b97ad 100644
> --- a/drivers/usb/serial/qcserial.c
> +++ b/drivers/usb/serial/qcserial.c
[...]
> @@ -199,9 +199,12 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id)
>   		dev_err(&serial->dev->dev,
>   			"unknown number of interfaces: %d\n", nintf);
>   		kfree(data);
> -		return -ENODEV;
> +		retval = -ENODEV;
>   	}
>
> +	/* Set serial->private if not returning -ENODEV */
> +	if ( retval != -ENODEV )

    No spaces after ( and before ) allowed.

WBR, Sergei
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ