Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp596898lqo; Thu, 16 May 2024 16:03:17 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCURc/moIu+GZmUhnpKKc//y8DphTP4Y/9d8z1QzXdyosPb4y78Za5ZxSdGQflTKhXHND4GUHRbYBY5SBDdjwXRMl1r+28ZO/umFXJIedA== X-Google-Smtp-Source: AGHT+IEke8pu7s+7p2o1LZpKtNddpZDat+ChuQy14REP/BQC87GPORDfxrkSkQVYfWJP7v8Ynmd0 X-Received: by 2002:a05:6870:f78f:b0:241:9bee:b704 with SMTP id 586e51a60fabf-2419beec837mr21698765fac.7.1715900596760; Thu, 16 May 2024 16:03:16 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715900596; cv=pass; d=google.com; s=arc-20160816; b=unM3kRgxunOEcRtKhEdOpu21fY9K9rIsvFkICG95dElSVrnvC+vwrW61nqy8LNj7FC +k+ODAtZAsrF/n8iqtt2pfhLbKuwXZi5gNL52wW57QduLZdgPjUhThX7+PnCAE2LvYdT 1ztxvtCn28sQNfL2vGw/EKx38muyXsmQh3IrvumpMF84kXZL0HZbCxBoJhXMb14dLMaG UAl69WVUEq6r3G1lSHNj9DW7UlIf/ShTg0a63+cJJI9jZE9luF4lBlWghyJxcRSJnOuz QV4aZohy/Vs81abbEo75XQtyaqwfzw0UgZO/oy1WaEc4wvi6X/UJeiqloz8K9TSaQVmf p8KA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=bul2ptxRqfIw2xpa+3EaGbCt68B5fdbbN1CJpCg6Z3U=; fh=VQX2w0ZcQJWfQ9VzdaEbqaHEaGeNfj2w1gG5euuEZ+Q=; b=jJbkVu6t9ionGKMGdJXn5XMqS7qu5Qx+ULE2IuBZ8GsmVz0UDQO5vKtRM1y+Q5vXIU RqoEe7s/IpzYe9b3O+j77MpjL8tLi3rrn5iI7KPSMiwvhoI/JBG5bkR3tJZZh7+uZR1f KfRt0NR37hW79QSIkHKJZGpNIdqKPOvcm+9pKuFEAqO9aXIJiF2oqKydu61k7V2Q8Jaj 5WsJG8W62K7v8TLPsQH69PHhzYtCf2nbRG5EsI2661bIEYSfZfkq0tedVZTmKbJDMvQg bsQCH2LphihqlGhQU5eTfh2a9D89hBAFWxDQVhvXgv2MsZ8M0M5mT26XJSYd8HIUX9zp HEPA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=iJxeRdtz; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-181625-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-181625-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id 71dfb90a1353d-4e0e38ad228si2156781e0c.95.2024.05.16.16.03.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 May 2024 16:03:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-181625-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=iJxeRdtz; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-181625-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-181625-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 73E241C218EC for ; Thu, 16 May 2024 23:03:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 13A043C488; Thu, 16 May 2024 23:02:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="iJxeRdtz" Received: from mail-qt1-f180.google.com (mail-qt1-f180.google.com [209.85.160.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BEE6A38382; Thu, 16 May 2024 23:02:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.180 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715900527; cv=none; b=H028+EDHbK625heQRZb1QirYdeSY9b8WcqQmoFy1Xb+kolrbjrllN02k9NyVSjCoLL9/Ov30Ni6FQK1Pzb7JHwAehyiryp2jwhrSB4/5ccqxFd2RvUB/MYsVppdkvy2jhrSAsRp8vsLcrHhgKv9314l0jWoOugytCpD1OEo5PZQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715900527; c=relaxed/simple; bh=L/r+/jSr7lZ1Um5u8jIULrtQvjAXq8IPrhDlnfrhdWA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=jZTDLqiv4SL8mJKaLZh4hpRK2iAoApi85wa01qHCLpbcq9Hr8oH4C3DaPZC22hPUGo2/4KHWo0oOVAzUs/KhtsjS/CCTh/z3QJkAgSycrrqBRcqr8c72R5CiE6J94YZPCcslIcpBYQGjp+7/B1W96y8lsxpJpommC+OC842key4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=iJxeRdtz; arc=none smtp.client-ip=209.85.160.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-qt1-f180.google.com with SMTP id d75a77b69052e-43e4020db92so440111cf.0; Thu, 16 May 2024 16:02:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715900524; x=1716505324; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=bul2ptxRqfIw2xpa+3EaGbCt68B5fdbbN1CJpCg6Z3U=; b=iJxeRdtzzOT1bgiBMVrHzY7s/mmq1xdOQYuZFU/55sRUGvwV82MHWMi+eVmdh2lbSg uDTOjTDqWwsZcQACsq0EQEovVaRe97Y9g1BUPjMJKylFzgNiTtQkcOkM8qIeebEQ328N bza1BwErJJUS9+WiI14BjEKswt6TJfK0QA18GL2EhMiTbM9rGuRg5Jgxm8kY/Ot5PvkI xJwG6hKstlVP6mSJ3d3OdJ4e/b1uYudnlWU2xJ94wgGe8j1FcDecVHKLi3VtsSYj7QRA C1ZhWL0smDdekRmOvOFKib5axXwkIvgTDjlvkTxRRNcEZ3SLbI5gbqD+aUUCOoivY4pY x10A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715900524; x=1716505324; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bul2ptxRqfIw2xpa+3EaGbCt68B5fdbbN1CJpCg6Z3U=; b=dlnCzLCDOe8hb9bqq1T9CEItED1tqvmmHSdde7YEcnW9boixJOlRAzJfgwSUxvDx10 tDpuSrsVixnLVPa99EP/McmR+yLsUudJprW2hkDDpaISj0asTXKs8PAk3pnXhSn21Hho BhFyeYWnUONLX/JQ2MfBi/0G4LkHqPiT0GTt/VGuTgikHITqaLE+R1ZDRrekTkYrRRph bnMlWC1XcuxbMgTtCF5GnroeEtNxWZXXID36Hgw/M3Llexy4HqYTGj6M+BYXsIq6ZZ8X O/xMdkuPlHmrWME9RtvF8hIDZ8ChP64PKYU5ajY+ATRpauMO9Sv8ko4i518SD1/wdB7Y mGWQ== X-Forwarded-Encrypted: i=1; AJvYcCX0dFO94YMKMYiFXEp4JEX7rHNSwsJXESfdaRdiWmCXRuSTx7K1UtsfwCYYVCE8zvn0fpJZ7caG7lRq49/rx2djOiw2EFx4/7A8tJ5VBdrzpbzzezU0eTRYQnJeCGf+dhJhO7ym X-Gm-Message-State: AOJu0Yzr4jYoIk7W5LC1MxRJUXnRA6ngMM1TtTgAMbVpkvUXDcGFAdun 5b0G9DhXPYm6e0DOp0AGq4HhDaTzQUMpdgfaJwVjqY5SfjlTTbCWuZxkwQ== X-Received: by 2002:ac8:71cd:0:b0:43e:607:f4d3 with SMTP id d75a77b69052e-43e0607f638mr153120191cf.48.1715900523735; Thu, 16 May 2024 16:02:03 -0700 (PDT) Received: from stbirv-lnx-1.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-43e251233c6sm47154851cf.84.2024.05.16.16.02.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 May 2024 16:02:03 -0700 (PDT) From: Doug Berger To: stable@vger.kernel.org Cc: Doug Berger , Florian Fainelli , "David S. Miller" , bcm-kernel-feedback-list@broadcom.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Florian Fainelli Subject: [PATCH stable 5.4 1/3] net: bcmgenet: synchronize EXT_RGMII_OOB_CTRL access Date: Thu, 16 May 2024 16:01:49 -0700 Message-Id: <20240516230151.1031190-2-opendmb@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240516230151.1031190-1-opendmb@gmail.com> References: <20240516230151.1031190-1-opendmb@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit [ Upstream commit d85cf67a339685beae1d0aee27b7f61da95455be ] The EXT_RGMII_OOB_CTRL register can be written from different contexts. It is predominantly written from the adjust_link handler which is synchronized by the phydev->lock, but can also be written from a different context when configuring the mii in bcmgenet_mii_config(). The chances of contention are quite low, but it is conceivable that adjust_link could occur during resume when WoL is enabled so use the phydev->lock synchronizer in bcmgenet_mii_config() to be sure. Fixes: afe3f907d20f ("net: bcmgenet: power on MII block for all MII modes") Cc: stable@vger.kernel.org Signed-off-by: Doug Berger Acked-by: Florian Fainelli Signed-off-by: David S. Miller --- drivers/net/ethernet/broadcom/genet/bcmmii.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/ethernet/broadcom/genet/bcmmii.c b/drivers/net/ethernet/broadcom/genet/bcmmii.c index 56fad34461f7..d0b59d1f6c73 100644 --- a/drivers/net/ethernet/broadcom/genet/bcmmii.c +++ b/drivers/net/ethernet/broadcom/genet/bcmmii.c @@ -269,6 +269,7 @@ int bcmgenet_mii_config(struct net_device *dev, bool init) * block for the interface to work */ if (priv->ext_phy) { + mutex_lock(&phydev->lock); reg = bcmgenet_ext_readl(priv, EXT_RGMII_OOB_CTRL); reg |= id_mode_dis; if (GENET_IS_V1(priv) || GENET_IS_V2(priv) || GENET_IS_V3(priv)) @@ -276,6 +277,7 @@ int bcmgenet_mii_config(struct net_device *dev, bool init) else reg |= RGMII_MODE_EN; bcmgenet_ext_writel(priv, reg, EXT_RGMII_OOB_CTRL); + mutex_unlock(&phydev->lock); } if (init) -- 2.34.1