Re: [PATCH] pinctrl: avoid unsafe code pattern in find_pinctrl()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Sep 20, 2023 at 8:09 PM Dmitry Torokhov
<dmitry.torokhov@xxxxxxxxx> 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@xxxxxxxxx>

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




[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux