[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240628205540.3098010-5-sean.anderson@linux.dev>
Date: Fri, 28 Jun 2024 16:55:39 -0400
From: Sean Anderson <sean.anderson@...ux.dev>
To: Radhey Shyam Pandey <radhey.shyam.pandey@....com>,
Laurent Pinchart <laurent.pinchart@...asonboard.com>,
linux-phy@...ts.infradead.org
Cc: Vinod Koul <vkoul@...nel.org>,
linux-arm-kernel@...ts.infradead.org,
Kishon Vijay Abraham I <kishon@...nel.org>,
linux-kernel@...r.kernel.org,
Michal Simek <michal.simek@....com>,
Sean Anderson <sean.anderson@...ux.dev>
Subject: [PATCH v3 4/5] 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 <sean.anderson@...ux.dev>
---
Changes in v3:
- New
drivers/phy/xilinx/phy-zynqmp.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/phy/xilinx/phy-zynqmp.c b/drivers/phy/xilinx/phy-zynqmp.c
index 4d697e11d8eb..991be42eef3d 100644
--- a/drivers/phy/xilinx/phy-zynqmp.c
+++ b/drivers/phy/xilinx/phy-zynqmp.c
@@ -759,6 +759,7 @@ static struct phy *xpsgtr_xlate(struct device *dev,
phy_type = args->args[1];
phy_instance = args->args[2];
+ guard(mutex)(>r_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");
--
2.35.1.1320.gc452695387.dirty
Powered by blists - more mailing lists