Commit c153a4e
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: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Link: https://lore.kernel.org/r/ZQs1RgTKg6VJqmPs@google.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>1 parent 64061b6 commit c153a4e
1 file changed
Lines changed: 9 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1022 | 1022 | | |
1023 | 1023 | | |
1024 | 1024 | | |
1025 | | - | |
| 1025 | + | |
1026 | 1026 | | |
1027 | 1027 | | |
1028 | | - | |
1029 | | - | |
1030 | | - | |
1031 | | - | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
1032 | 1034 | | |
| 1035 | + | |
1033 | 1036 | | |
1034 | 1037 | | |
1035 | | - | |
| 1038 | + | |
1036 | 1039 | | |
1037 | 1040 | | |
1038 | 1041 | | |
| |||
1140 | 1143 | | |
1141 | 1144 | | |
1142 | 1145 | | |
1143 | | - | |
1144 | 1146 | | |
1145 | 1147 | | |
1146 | 1148 | | |
| |||
0 commit comments