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]
Date:	Tue, 21 Sep 2010 15:20:31 -0700
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	Vasiliy Kulikov <segooon@...il.com>
Cc:	kernel-janitors@...r.kernel.org, Tejun Heo <tj@...nel.org>,
	Jiri Slaby <jirislaby@...il.com>, linux-kernel@...r.kernel.org,
	Greg KH <greg@...ah.com>
Subject: Re: [PATCH 04/14] memstick: core: fix device_register() error
 handling

On Sun, 19 Sep 2010 16:54:49 +0400
Vasiliy Kulikov <segooon@...il.com> wrote:

> If device_register() fails then call put_device().
> See comment to device_register.
> 
> Signed-off-by: Vasiliy Kulikov <segooon@...il.com>
> ---
>  compile tested.
> 
>  drivers/memstick/core/memstick.c |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/memstick/core/memstick.c b/drivers/memstick/core/memstick.c
> index c00fe82..4303b7e 100644
> --- a/drivers/memstick/core/memstick.c
> +++ b/drivers/memstick/core/memstick.c
> @@ -465,6 +465,7 @@ static void memstick_check(struct work_struct *work)
>  		if (!host->card) {
>  			host->card = card;
>  			if (device_register(&card->dev)) {
> +				put_device(&card->dev);
>  				kfree(host->card);
>  				host->card = NULL;
>  			}

A failed device_register() takes a bogus ref on the not-registered
device?  It's no surprise that people are getting this wrong.  

The principle of least surprise says: fix device_register()!
--
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