[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAPXgP11S6R4L-8tZ4cPY=MZfcvTBBHkUdTvt7FTKhvhVF6uKPQ@mail.gmail.com>
Date: Mon, 16 Apr 2012 13:51:46 +0200
From: Kay Sievers <kay@...y.org>
To: Hannes Reinecke <hare@...e.de>
Cc: Linux Kernel <linux-kernel@...r.kernel.org>,
Greg Kroah-Hartmann <gregkh@...uxfoundation.org>,
Kay Sievers <ksievers@...y.org>,
Stable Kernel <stable@...nel.org>
Subject: Re: [PATCH] driver core: check 'start' argument in bus iterators
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?
This check otherwise still has the window between the check and the
use of it, only very unlikely to hit now, hasn't it?
Kay
--
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