summaryrefslogtreecommitdiff
path: root/drivers/phy
diff options
context:
space:
mode:
authorSean Anderson <sean.anderson@linux.dev>2024-06-28 16:55:39 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-09-12 11:10:22 +0200
commitba34fcfe32060b9ad812f747ab755ea19648cd62 (patch)
treefd8a49412211042e1275fbc75ddb7a54988e3494 /drivers/phy
parent135e3ad35318da30d27026ad1ec601fb04518d64 (diff)
downloadlinux-ba34fcfe32060b9ad812f747ab755ea19648cd62.tar.gz
linux-ba34fcfe32060b9ad812f747ab755ea19648cd62.tar.bz2
linux-ba34fcfe32060b9ad812f747ab755ea19648cd62.zip
phy: zynqmp: Take the phy mutex in xlate
[ Upstream commit d79c6840917097285e03a49f709321f5fb972750 ] 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 <sean.anderson@linux.dev> Link: https://lore.kernel.org/r/20240628205540.3098010-5-sean.anderson@linux.dev Signed-off-by: Vinod Koul <vkoul@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/phy')
-rw-r--r--drivers/phy/xilinx/phy-zynqmp.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/phy/xilinx/phy-zynqmp.c b/drivers/phy/xilinx/phy-zynqmp.c
index ac9a9124a36d..cc36fb7616ae 100644
--- a/drivers/phy/xilinx/phy-zynqmp.c
+++ b/drivers/phy/xilinx/phy-zynqmp.c
@@ -847,6 +847,7 @@ static struct phy *xpsgtr_xlate(struct device *dev,
phy_type = args->args[1];
phy_instance = args->args[2];
+ guard(mutex)(&gtr_phy->phy->mutex);
ret = xpsgtr_set_lane_type(gtr_phy, phy_type, phy_instance);
if (ret < 0) {
dev_err(gtr_dev->dev, "Invalid PHY type and/or instance\n");