From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F10B616F0F9; Thu, 1 Aug 2024 00:25:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722471949; cv=none; b=h+u674rsS9MeyXHinJHIdi0lagmBYR2H0kXyRb3XwyOW/PIEkZXhk/a70iHZB0kKNMSpcwXE2p2is0UiVnKqVnFpHkcwEpu4Lkg1t0+F9Nu5SKaZ0UsiKIq6kkzQ4fwlpfP8DQrfT+mKSyje4EWhjAkKYjQIHZS5fIiUOiqc41c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722471949; c=relaxed/simple; bh=xGhvvW5Nb1lltgltgtaN920HQ82BD/KDG6WYsOpH+9o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VqrWQZJ36XWTmFgg0xjNSUuP+vSR46f14bJeJO7KL/Dv27T0IeUkxKg0BJL4LkldZBouNa+C/F61fDPjyTT4MejX22pK9TiEx/0krlqTHdxVH7ctuHBh+vf1LQnZW/Jya5tfUqLE2NXBtiYSBdj5AgeIHEFm/FdgyTM7avCFEhE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=p+hoCl+L; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="p+hoCl+L" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9DF10C4AF0C; Thu, 1 Aug 2024 00:25:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722471948; bh=xGhvvW5Nb1lltgltgtaN920HQ82BD/KDG6WYsOpH+9o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p+hoCl+LIdQsu7aaqPLKcgr7Iyq/1D8wQi2CBT8xlz9cnEBdKy5p47R5CuTF9oBwt fXYqAYqHnPMdr79kYlx0y8k+a1nd/vxPOAkP1MZfp3VOW9AyOyPRIAvyLlYJem65MB F1oztwRRlc9Lfy1sqSofPVqBPrD2IKzZFGqXoDG2Idgz35PFBCtD8tjrSWkxPfo+I5 IhE2kY/gQe9uLTQOH8yUNsVHBweojaiKpiIJ2MHA0pzriNQ84xXY982uppZc4PgBza 41j+bzqhdQo1kYoyI3R4o7dBPznZQdYXyZzt8QHaczAKFntid4yHFaA3QE4f1pMMpC CBWUpP/SsaoFg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Sean Anderson , Vinod Koul , Sasha Levin , laurent.pinchart@ideasonboard.com, kishon@kernel.org, michal.simek@amd.com, linux-phy@lists.infradead.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH AUTOSEL 6.6 70/83] phy: zynqmp: Take the phy mutex in xlate Date: Wed, 31 Jul 2024 20:18:25 -0400 Message-ID: <20240801002107.3934037-70-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240801002107.3934037-1-sashal@kernel.org> References: <20240801002107.3934037-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.6.43 Content-Transfer-Encoding: 8bit From: Sean Anderson [ 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 Link: https://lore.kernel.org/r/20240628205540.3098010-5-sean.anderson@linux.dev Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- 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 2559c6594cea2..b2b761e8d6a3a 100644 --- a/drivers/phy/xilinx/phy-zynqmp.c +++ b/drivers/phy/xilinx/phy-zynqmp.c @@ -798,6 +798,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.43.0