[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CACRpkdadZoDMmUbwM-AxAsrr5QsmA5en2Cj-xghvEsak+mq-eQ@mail.gmail.com>
Date: Fri, 13 Jan 2017 16:32:13 +0100
From: Linus Walleij <linus.walleij@...aro.org>
To: Thierry Reding <thierry.reding@...il.com>
Cc: "linux-gpio@...r.kernel.org" <linux-gpio@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Jonathan Hunter <jonathanh@...dia.com>
Subject: Re: [PATCH] pinctrl: Initialize pinctrl_dev.node
On Thu, Jan 12, 2017 at 5:03 PM, Thierry Reding
<thierry.reding@...il.com> wrote:
> From: Thierry Reding <treding@...dia.com>
>
> The struct pinctrl_dev's node field is not properly set up, which means
> the .prev and .next fields will be NULL. That's not something that the
> linked list code can deal with, so extra care must be taken when using
> these fields. An example of this is introduced in commit 3429fb3cda34
> ("pinctrl: Fix panic when pinctrl devices with hogs are unregistered")
> where list_del() is made conditional on the pinctrl device being part
> of the pinctrl device list. This is to ensure that list_del() won't
> crash upon encountering a NULL pointer in .prev and/or .next.
>
> After initializing the list head there's no need to jump through these
> extra hoops and list_del() will work unconditionally. This is because
> the initialized list head points to itself and therefore the .prev and
> .next fields can be properly dereferenced.
>
> Cc: Jonathan Hunter <jonathanh@...dia.com>
> Signed-off-by: Thierry Reding <treding@...dia.com>
Nice catch!
Sorry for my sloppy semantics...
Patch applied, had to rebase it with patch -p1 < foo.patch
so check the result on my devel branch or linux-next
soon-ish.
Yours,
Linus Walleij
Powered by blists - more mailing lists