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] [day] [month] [year] [list]
Message-ID: <4F8C0C2F.7020306@suse.de>
Date:	Mon, 16 Apr 2012 14:10:23 +0200
From:	Hannes Reinecke <hare@...e.de>
To:	Kay Sievers <kay@...y.org>
Cc:	Linux Kernel <linux-kernel@...r.kernel.org>,
	Greg Kroah-Hartmann <gregkh@...uxfoundation.org>,
	Stable Kernel <stable@...nel.org>
Subject: Re: [PATCH] driver core: check 'start' argument in bus iterators

On 04/16/2012 01:51 PM, Kay Sievers wrote:
> On Mon, Apr 16, 2012 at 12:48, Hannes Reinecke <hare@...e.de> wrote:
>> bus_for_each_dev() and bus_find_device() both take a 'start'
>> argument to start the iteration at a specific list entry.
>> However, this list entry might already been detached by
>> the time these functions are called.
>> So we need to check if the arguments are still valid.
> 
>> +       if (start && !klist_node_attached(&start->p->knode_bus))
>> +               return -ENODEV;
>> +
>>        klist_iter_init_node(&bus->p->klist_devices, &i,
>>                             (start ? &start->p->knode_bus : NULL));
> 
> Shouldn't we do this check in klist_iter_init_node()?
> After a kref_get(), and return -ENODEV from there if the node it as
> asked to start is gone?
> 
Sure, if you prefer.

> This check otherwise still has the window between the check and the
> use of it, only very unlikely to hit now, hasn't it?
> 
yeah, very.
The iteration itself could take some time (locks etc), but the race
between those two lines is really tiny.

But yeah, for the sake of correctness, we should.

I'll be sending an updated patch.

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		      zSeries & Storage
hare@...e.de			      +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)
--
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