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: <AANLkTi=8LGCVqchpQrB+31FRqK04+3xLFCuak0S1FHpK@mail.gmail.com>
Date:	Sat, 2 Oct 2010 15:45:50 +0800
From:	Ming Lei <tom.leiming@...il.com>
To:	Rahul Ruikar <rahul.ruikar@...il.com>
Cc:	Greg Kroah-Hartman <gregkh@...e.de>, Tejun Heo <tj@...nel.org>,
	asanchez@...rowork.net, rjw@...k.pl, linux-usb@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] usb: core: endpoint: Fix error path

2010/10/2 Rahul Ruikar <rahul.ruikar@...il.com>:
> In function usb_create_ep_devs()
> call put_device() when device_register() fails.
>
> Signed-off-by: Rahul Ruikar <rahul.ruikar@...il.com>
> ---
>  drivers/usb/core/endpoint.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/usb/core/endpoint.c b/drivers/usb/core/endpoint.c
> index 3788e73..cab126d 100644
> --- a/drivers/usb/core/endpoint.c
> +++ b/drivers/usb/core/endpoint.c
> @@ -195,8 +195,10 @@ int usb_create_ep_devs(struct device *parent,
>        device_enable_async_suspend(&ep_dev->dev);
>
>        retval = device_register(&ep_dev->dev);
> -       if (retval)
> +       if (retval) {
> +               put_device(&ep_dev->dev);
>                goto error_register;
> +       }
>
>        endpoint->ep_dev = ep_dev;
>        return retval;
> --

You should replace kfree(ep_dev) with put_device(&ep_dev->dev),
otherwise double free will be triggered.

So you need to revise the patch...

-- 
Lei Ming
--
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