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: <A578B7C2-D1FA-4F14-999F-E4CAA4816BB3@coraid.com>
Date:	Fri, 7 Dec 2012 07:20:10 -0600
From:	Ed Cashin <ecashin@...aid.com>
To:	Dan Carpenter <dan.carpenter@...cle.com>
CC:	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"kernel-janitors@...r.kernel.org" <kernel-janitors@...r.kernel.org>
Subject: Re: [patch] aoe: use after free in aoedev_by_aoeaddr()

On Dec 7, 2012, at 1:19 AM, Dan Carpenter wrote:

> We should return NULL on failure instead of returning a freed pointer.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@...cle.com>
> 
> diff --git a/drivers/block/aoe/aoedev.c b/drivers/block/aoe/aoedev.c
> index e66ccbf..98f2965 100644
> --- a/drivers/block/aoe/aoedev.c
> +++ b/drivers/block/aoe/aoedev.c
> @@ -461,6 +461,7 @@ aoedev_by_aoeaddr(ulong maj, int min, int do_alloc)
> 	d->targets = kcalloc(NTARGETS, sizeof(*d->targets), GFP_ATOMIC);
> 	if (!d->targets) {
> 		kfree(d);
> +		d = NULL;
> 		goto out;
> 	}
> 	d->ntargets = NTARGETS;


That looks good, thanks.

If smatch found that, then I have to figure out what I'm doing wrong, because
I ran sparse and smatch on the latest patch series until they were clean.  :/

-- 
  Ed Cashin
  ecashin@...aid.com


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