Skip to content
Commit c153a4ed authored by Dmitry Torokhov's avatar Dmitry Torokhov Committed by Linus Walleij
Browse files

pinctrl: avoid unsafe code pattern in find_pinctrl()



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.

Cc: stable@vger.kernel.org
Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
Link: https://lore.kernel.org/r/ZQs1RgTKg6VJqmPs@google.com


Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 64061b67
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment