From nobody Tue Feb 10 19:09:47 2026 Received: from mail-qk1-f179.google.com (mail-qk1-f179.google.com [209.85.222.179]) (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 EA38C303A15 for ; Sun, 8 Feb 2026 22:56:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770591375; cv=none; b=ryDHb7zmiA5OIuXHjanyS/AnnjWiWAvDhEM1uya7HTJtEIZInEVZeaLaqSVQsftTmqSdGAFELaZTOFVGU8ofeoW46BrW0GVMY3MTo1VqfInYMSy+M8Pd08FYRrJtupSCXn8gnnmyXm9cm1cNb16CVgwng/4EIpLjRh4pQtRRckM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770591375; c=relaxed/simple; bh=s8VGpGMSGaZ2+p5mTzzQyysE0AJW/x8r5xi6k/4c5gI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=agToPY24hW2sY4pIyMcPn+ea/TKa4efyjhh6F0mbZZ5VUmq0aZujUlOdhwMB8Deeh5DY7IbkhLWtgjtqPWbCECgGzsJAbJUgcKBDP2eYUASR01J5Le6W6ccw6QMy40NxiUOKLogWi2meAUC/gLfCMqCABnCf0yXhyA27I56A/rE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=u.northwestern.edu; spf=pass smtp.mailfrom=u.northwestern.edu; dkim=pass (2048-bit key) header.d=u-northwestern-edu.20230601.gappssmtp.com header.i=@u-northwestern-edu.20230601.gappssmtp.com header.b=bWHPh5Oh; arc=none smtp.client-ip=209.85.222.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=u.northwestern.edu Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=u.northwestern.edu Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=u-northwestern-edu.20230601.gappssmtp.com header.i=@u-northwestern-edu.20230601.gappssmtp.com header.b="bWHPh5Oh" Received: by mail-qk1-f179.google.com with SMTP id af79cd13be357-8ca01dc7d40so413055885a.1 for ; Sun, 08 Feb 2026 14:56:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=u-northwestern-edu.20230601.gappssmtp.com; s=20230601; t=1770591374; x=1771196174; 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=RsIvHDz2axLyTXF6o/p1gIQLrDHj0fdiTLIqaKocJCQ=; b=bWHPh5Ohn9PgORxTg3OTBVQK1BShO75ZjuRFk2hoJBJ6je749OxI28mZugXYsiuN5b 6cLFMq+SwmdN53hW2+PfSj388B4slEIeRbYhaYWpxV1IZ6ZtKx9XcyFf64MYelhRomyq LLrBMrNiNgaW7rPO0cK1a07YKLQ69JMRicXIeCSTuMiZkedRm4l6Kpz4Fw4Q7mGnqrJq ckn8i1VEqbWpnJQnn0CM7u7P4KC5S8WZ3tHrKNUinkrAraSu3qZjUsyL01pPiaaSFrXr Gg+FPZTgHP5W6yzVpwOy3R4wa+6PctvgOdYIVQBKIsJdqr1yzg0e3XmcBegPS+sz+yLd ZaOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770591374; x=1771196174; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=RsIvHDz2axLyTXF6o/p1gIQLrDHj0fdiTLIqaKocJCQ=; b=hq5W9Q65R8ILdu+TqXwlji+xqlwusO6jH0Mm2Y8wQlgFA65EgcgAH3mBEkfmpg1qkA leylbNtX9fW+Xgc4cgdSUZaE4de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BM= X-Received: by 2002:a05:620a:458e:b0:8c6:de6f:898e with SMTP id af79cd13be357-8caefcca7d5mr1105942585a.9.1770591373816; Sun, 08 Feb 2026 14:56:13 -0800 (PST) Received: from security.cs.northwestern.edu (security.cs.northwestern.edu. [165.124.184.136]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8caf9ee9efasm679622485a.43.2026.02.08.14.56.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Feb 2026 14:56:13 -0800 (PST) From: Ziyi Guo To: Vladimir Oltean , Claudiu Manoil , Alexandre Belloni Cc: UNGLinuxDriver@microchip.com, Andrew Lunn , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Ziyi Guo Subject: [PATCH v3 3/3] net: mscc: ocelot: add missing lock protection in ocelot_port_xmit_inj() Date: Sun, 8 Feb 2026 22:56:02 +0000 Message-Id: <20260208225602.1339325-4-n7l8m4@u.northwestern.edu> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260208225602.1339325-1-n7l8m4@u.northwestern.edu> References: <20260208225602.1339325-1-n7l8m4@u.northwestern.edu> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" ocelot_port_xmit_inj() calls ocelot_can_inject() and ocelot_port_inject_frame() without holding the injection group lock. Both functions contain lockdep_assert_held() for the injection lock, and the correct caller felix_port_deferred_xmit() properly acquires the lock using ocelot_lock_inj_grp() before calling these functions. Add ocelot_lock_inj_grp()/ocelot_unlock_inj_grp() around the register injection path to fix the missing lock protection. The FDMA path is not affected as it uses its own locking mechanism. Fixes: c5e12ac3beb0 ("net: mscc: ocelot: serialize access to the injection/= extraction groups") Signed-off-by: Ziyi Guo --- drivers/net/ethernet/mscc/ocelot_net.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/mscc/ocelot_net.c b/drivers/net/ethernet/= mscc/ocelot_net.c index d6b0936beca2..9fd8ac7e875c 100644 --- a/drivers/net/ethernet/mscc/ocelot_net.c +++ b/drivers/net/ethernet/mscc/ocelot_net.c @@ -597,14 +597,22 @@ static netdev_tx_t ocelot_port_xmit_inj(struct sk_buf= f *skb, int port =3D priv->port.index; u32 rew_op =3D 0; =20 - if (!ocelot_can_inject(ocelot, 0)) + ocelot_lock_inj_grp(ocelot, 0); + + if (!ocelot_can_inject(ocelot, 0)) { + ocelot_unlock_inj_grp(ocelot, 0); return NETDEV_TX_BUSY; + } =20 - if (!ocelot_xmit_timestamp(ocelot, port, skb, &rew_op)) + if (!ocelot_xmit_timestamp(ocelot, port, skb, &rew_op)) { + ocelot_unlock_inj_grp(ocelot, 0); return NETDEV_TX_OK; + } =20 ocelot_port_inject_frame(ocelot, port, 0, rew_op, skb); =20 + ocelot_unlock_inj_grp(ocelot, 0); + consume_skb(skb); =20 return NETDEV_TX_OK; --=20 2.34.1