[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACRpkdbuOn4gKBE-tB4MHQ3mx_ujQZLdPp1hp75ANFgsGb1jQQ@mail.gmail.com>
Date: Mon, 25 Sep 2023 15:30:53 +0200
From: Linus Walleij <linus.walleij@...aro.org>
To: Dmitry Torokhov <dmitry.torokhov@...il.com>
Cc: Bartosz Golaszewski <bartosz.golaszewski@...aro.org>,
linux-gpio@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] pinctrl: avoid unsafe code pattern in find_pinctrl()
On Wed, Sep 20, 2023 at 8:09 PM Dmitry Torokhov
<dmitry.torokhov@...il.com> wrote:
> The code in find_pinctrl() takes a mutex and traverses a list of pinctrl
> structures. Later the caller bumps up reference count on the found
> structure. Such pattern is not safe as pinctrl that was found may get
> deleted before the caller gets around to increasing the reference count.
>
> Fix this by taking the reference count in find_pinctrl(), while it still
> holds the mutex.
>
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@...il.com>
After some thinking, applied for fixes and tagged for stable as
it is a very real problem that can cause random crashes under
the right circumstances.
Thanks for finding this Dmitry!!
Yours,
Linus Walleij
Powered by blists - more mailing lists