Re: [RFC][2.5] list_for_each_safe not so safe (was Re: OOPS

Martin Schlemmer (azarah@gentoo.org)
13 Jun 2003 08:08:48 +0200


On Fri, 2003-06-13 at 04:36, Mark M. Hoffman wrote:

> > Nope, this do not fix it.
> >
> > The problem is actually at the i2c driver side. From
> > drivers/i2c/i2c-core.c in i2c_del_driver(), we have:
> <cut>
>
> To recap: list_for_each_safe() is not safe for deleting other than
> the current "item". But I disagree with you Martin because I think
> the usage in i2c_del_driver is ok as is; and that w83781d.c should
> change...
>

Right, I will not argue, as I was not sure on usage (and thus the
mail). Might be right thing (tm) to send a patch to make it more
clear that its only 'safe' for current item deletion (against
list.h) ?

> My first patch was naive; the patch below solves the problem by
> letting w83781d_detach_client remove the three clients (1 * primary
> + 2 * subclients) independently. It's a noisy patch because I had
> to change the way the subclients were kmalloc'ed - sorry. The meat
> is around line 1422. This patch works for me... comments?
>

I did try this way, but did it rather brutish =) It thus still did
not fix it. Your patch looks good ... I will try it tonight at home.

Regards,

-- 
Martin Schlemmer

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/