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: <4CA9B004.3020103@ru.mvista.com>
Date:	Mon, 04 Oct 2010 14:44:20 +0400
From:	Sergei Shtylyov <sshtylyov@...sta.com>
To:	Rahul Ruikar <rahul.ruikar@...il.com>
CC:	David Brownell <dbrownell@...rs.sourceforge.net>,
	Greg Kroah-Hartman <gregkh@...e.de>,
	Joe Perches <joe@...ches.com>, linux-usb@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] usb: gadget: langwell_udc: Fix error path

Hello.

On 03-10-2010 17:49, Rahul Ruikar wrote:

> - call device_unregister() only when device_register() is sucess.

    s/is sucess/succeeds/

> - call put_device() when device_register() fails.

> Signed-off-by: Rahul Ruikar<rahul.ruikar@...il.com>
> ---
>   drivers/usb/gadget/langwell_udc.c |   18 ++++++++++++++----
>   drivers/usb/gadget/langwell_udc.h |    4 +++-
>   2 files changed, 17 insertions(+), 5 deletions(-)

> diff --git a/drivers/usb/gadget/langwell_udc.c b/drivers/usb/gadget/langwell_udc.c
> index c2d2a20..2b5ae16 100644
> --- a/drivers/usb/gadget/langwell_udc.c
> +++ b/drivers/usb/gadget/langwell_udc.c
> @@ -2952,8 +2952,13 @@ static void langwell_udc_remove(struct pci_dev *pdev)
>   	INFO(dev, "unbind\n");
>   	DBG(dev, "<--- %s()\n", __func__);
>
> -	device_unregister(&dev->gadget.dev);
> -	device_remove_file(&pdev->dev,&dev_attr_langwell_udc);
> +	if (dev->dev_reg_status == 2)
> +		device_unregister(&dev->gadget.dev);
> +	else if (dev->dev_reg_status == 1)
> +		put_device(&dev->gadget.dev);
> +
> +	if (dev->dev_create_file)
> +		device_remove_file(&pdev->dev,&dev_attr_langwell_udc);
>
>   #ifndef	OTG_TRANSCEIVER
>   	pci_set_drvdata(pdev, NULL);
> @@ -3190,12 +3195,17 @@ static int langwell_udc_probe(struct pci_dev *pdev,
>   	the_controller = dev;
>
>   	retval = device_register(&dev->gadget.dev);
> -	if (retval)
> +	if (retval) {
> +		dev_reg_status = 1;

    Did you mean 'dev->dev_reg_status'?

>   		goto error;
> +	}
> +	dev_reg_status = 2;

    Same question.

>
>   	retval = device_create_file(&pdev->dev,&dev_attr_langwell_udc);
> -	if (retval)
> +	if (retval) {
> +		dev_create_file = 1;

    Did you mean 'dev->dev_create_file'?

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