diff options
| author | Bryan O'Donoghue <bryan.odonoghue@linaro.org> | 2026-09-18 14:56:36 +0100 |
|---|---|---|
| committer | Vinod Koul <vkoul@kernel.org> | 2026-09-23 18:00:28 +0530 |
| commit | 090055ee629523092688da42428558ba56d4272f (patch) | |
| tree | 50c46d3f0c708301c5dcb31ffdaf63fdc93a4d22 /tools/perf/scripts/python | |
| parent | 772ff99404a101e8d216f869c606cbd0d1d37752 (diff) | |
| download | linux-next-090055ee629523092688da42428558ba56d4272f.tar.gz linux-next-090055ee629523092688da42428558ba56d4272f.zip | |
phy: core: Fix race-condition between _of_phy_get() and try_module_get()
Sashiko asked during a patch review if the existing usage pattern had a
race condition; specifically in of_phy_get() if it was possible between
returning from _of_phy_get() and running try_module_get() that a module
might be unbound leading to use-after-free.
Looking at the code this appears to be so, there is no linkage between the
phy and module under a synchronisation primitive.
Using the phy_provider_mutex in phy_get() will ensure there is a link between
the returned phy pointer and the module_get() bumping the module reference
count.
Amend phy_get(), of_phy_get() and devm_of_phy_get_by_index() to fix the
same usage pattern.
phy_provider_unregister() must take the phy_provider_mutex so amending
phy_get()/of_phy_get() to take that same mutex guarantees there is no
use-after-free.
Fixes: ff764963479a1 ("drivers: phy: add generic PHY framework")
Cc: stable@vger.kernel.org
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
Reviewed-by: Loic Poulain <loic.poulain@oss.qualcomm.com>
Tested-by: Oleg Keri <okerixx@gmail.com> # Lenovo Yoga Slim 7x Gen 11 (Glymur)
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Link: https://patch.msgid.link/20260918-b4-linux-next-25-03-13-dtsi-x1e80100-camss-v20-1-dc244e124e71@linaro.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Diffstat (limited to 'tools/perf/scripts/python')
0 files changed, 0 insertions, 0 deletions
