Skip to content

Commit d79c684

Browse files
Sean Andersonvinodkoul
authored andcommitted
phy: zynqmp: Take the phy mutex in xlate
Take the phy mutex in xlate to protect against concurrent modification/access to gtr_phy. This does not typically cause any issues, since in most systems the phys are only xlated once and thereafter accessed with the phy API (which takes the locks). However, we are about to allow userspace to access phys for debugging, so it's important to avoid any data races. Signed-off-by: Sean Anderson <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vinod Koul <[email protected]>
1 parent 235d8b6 commit d79c684

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/phy/xilinx/phy-zynqmp.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -759,6 +759,7 @@ static struct phy *xpsgtr_xlate(struct device *dev,
759759
phy_type = args->args[1];
760760
phy_instance = args->args[2];
761761

762+
guard(mutex)(&gtr_phy->phy->mutex);
762763
ret = xpsgtr_set_lane_type(gtr_phy, phy_type, phy_instance);
763764
if (ret < 0) {
764765
dev_err(gtr_dev->dev, "Invalid PHY type and/or instance\n");

0 commit comments

Comments
 (0)