From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796505733; b=fWikDxMeILYXCFCpEWDCpI5ERyCXvhsTYJ5Jf/rhZf/U/2mOYCq+Cy9OpEtn+s+1GPkJ nNgaABuSDfaQ8SSTlHmcQVbhcnY+AJvsV9l2NRXYDPbRcaoLchWBJ9uGY+OMDRyYfXUP6 CdSYVzqyS6jb2PacEXwSGZqRKGAgbbcSeVFRg/AuWmgjV0dOA9fGiAS3HM9x3EFqbdoZe a7kAmgivqfyLyf9sNc53bKnTgOWDyhhYdbWsz256ugA7eKNeYDkS72Bz/sm1i0VVSfgM8 hn7TaujTIDyfXjTAETFbpLuDJ2Gu1FIvTpwtoF6IDgXFyMI5whPcA5i6tW6q8pT61Iw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796505733; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=wWu9ysURfel5buZH6uZJq7W0e7XhTqlQL8oOBny94V4=; b=DY9BHKJdRERYGjOy9l8IeXfeYb/onQhj7UCLGpeEc+oRjPFnn6gTxF9G8CBFVK3Oz8Yy xKtCd7/yxkKKEFMAoLWtqs/U/3RIWh+3ERs2Efbk715EnoT0cTgQkK/fb1OCn04U9baGn 0L/hHlQnv10Dfn4R8BLcQ6af0XJqoiWDJ+00oFpKob8dzKx9t4cGsWhwdHVQE2eR7gWBS TTb2odxlXIH5XixziQaq4/HxqZoYui2eusQbaGtB5sFgX2SUFz5o6jSgCw8fDR06kKRsO U2E9mzngczn+6wDHmzMMwJTvOL3Pf79EVZDMBgqm6rVLkoZDpcoFF0AMIV4VNqoe0ag== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=f6mNauCK; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B5034606A31F for ; Sat, 5 Dec 2026 21:22:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=f6mNauCK Received: by smtp.kernel.org (Postfix) with ESMTPSA id 836361F0092B; Sat, 5 Dec 2026 21:22:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796505733; bh=wWu9ysURfel5buZH6uZJq7W0e7XhTqlQL8oOBny94V4=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=f6mNauCKsd09nA95NNIZkGwfRyj9XTtnl5B227vyr9hFEefEqXTqdC89sr7XaAagI QhtLX5hZx1/JdB6LJtCbVdpHyfxfK4fGhxambT4k9zUL/bXct/d5VO/TAbOejm6x8O 893P87np4u+gmnxsjrAyi9vvhzV2UasM/dnLJfgmqfJgNfT4sffZqz7myALEl//GzL O7/jDsTFH+krtcRfxrcDyKJPpWcTq61hAtuB+6NOqXmeAQDwTspjXpG9jtZGsi/sYw 3ZpoMS4ErBhpp50oTCCd3wlMmL5IkJGMVl+cy7jxX8oEt74ApYAMfuzu9LXFLmlijT Zrm4N17GvklTA== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH net-next v4 1/2] net: usb: ax88179: Make receiving FCS on AX88179A configurable Reply-To: sashiko-reviews@lists.linux.dev To: "Birger Koblitz" Cc: linux-usb@vger.kernel.org In-Reply-To: <20261204-fcs-v4-1-32773b612c81@birger-koblitz.de> References: <20261204-fcs-v4-0-32773b612c81@birger-koblitz.de> <20261204-fcs-v4-1-32773b612c81@birger-koblitz.de> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Sat, 05 Dec 2026 21:22:13 +0000 X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Medium] net: usb: ax88179: unlocked rxctl RMW in ax88179_set_multicast() -- commit 92e42adb3b2a81ab9beb3f4942dd4fe939e57e19 Author: Birger Koblitz net: usb: ax88179: Make receiving FCS on AX88179A configurable This commit changes ax88179_set_multicast() on AX88179A and newer chips to read-modify-write data->rxctl and set AX_RX_CTL_DROPCRCERR based on NETIF_F_RXFCS and NETIF_F_RXALL. It also stops setting AX_RX_CTL_DROPCRCERR by default in ax88179a_reset(). > diff --git a/drivers/net/usb/ax88179_lib.c b/drivers/net/usb/ax88179_lib.c > index 821ee9cd8ded1..273c5946e16a1 100644 > --- a/drivers/net/usb/ax88179_lib.c > +++ b/drivers/net/usb/ax88179_lib.c > @@ -352,14 +352,22 @@ void ax88179_set_multicast(struct net_device *net) > struct usbnet *dev =3D netdev_priv(net); > u8 *m_filter =3D ((u8 *)dev->data); > struct ax88179_data *data; > - u16 rxctl =3D 0; > + u16 rxctl; > =20 > data =3D dev->driver_priv; > =20 > - rxctl =3D (AX_RX_CTL_START | AX_RX_CTL_AB | AX_RX_CTL_DROPCRCERR); > + if (data->chip_version >=3D AX_VERSION_AX88179A) { > + rxctl =3D READ_ONCE(data->rxctl); > + rxctl &=3D ~(AX_RX_CTL_IPE | AX_RX_CTL_DROPCRCERR | AX_RX_CTL_PRO | > + AX_RX_CTL_AMALL | AX_RX_CTL_AM); > + } else { > + rxctl =3D (AX_RX_CTL_START | AX_RX_CTL_AB | AX_RX_CTL_DROPCRCERR); > + } > if (data->ip_align) > rxctl |=3D AX_RX_CTL_IPE; > - > + if (net->features & (NETIF_F_RXFCS | NETIF_F_RXALL) || > + data->chip_version !=3D AX_VERSION_AX88179A) > + rxctl |=3D AX_RX_CTL_DROPCRCERR; /* Do not remove FCS from frame */ > if (net->flags & IFF_PROMISC) { > rxctl |=3D AX_RX_CTL_PRO; > } else if (net->flags & IFF_ALLMULTI || [Severity: Medium] Can this unlocked read-modify-write of data->rxctl race with other AX_RX_CTL writers and leave data->rxctl out of sync with hardware? __dev_set_rx_mode() calls ax88179_set_multicast() in BH context holding only netif_addr_lock_bh() without RTNL. Neither ax88179a_resume() -> ax88179a_reset() (which runs while netif_device_present() stays true) nor ax88179a_mac_link_up() takes netif_addr_lock_bh(): CPU0 CPU1 ax88179a_resume() ax88179a_reset() ax88179_write_u16(..., 0) __dev_set_rx_mode() ax88179_set_multicast() rxctl =3D READ_ONCE(data->rxctl) WRITE_ONCE(ax179_data->rxctl, ...) ax88179_write_u16(..., rxctl) WRITE_ONCE(data->rxctl, rxctl) ax88179_write_cmd_async(...) <-- clobbers rxctl / AX_RX_CTL This allows lost updates to data->rxctl, out-of-order async and synchronous AX_RX_CTL writes, or re-enabling AX_RX_CTL_START mid-reset or during link-u= p. Reading net->features without RTNL also races with __netdev_update_features= (), which calls ndo_set_features() before updating dev->features. With commit "net: usb: ax88179: Support NETIF_F_RXFCS and NETIF_F_RXALL on AX88179A", a concurrent ax88179_set_multicast() can overwrite AX_RX_CTL_DROPCRCERR from stale net->features, leaving ax88179a_rx_fixup() out of sync with hardware FCS stripping. That follow-up commit does not resolve this race either, as ax88179_set_multicast() still reads net->features without RTNL, submits its async write outside rx_ctl_mutex, and ax88179a_reset() remains unlocked. Consider serializing rxctl updates with a spinlock_bh or deferring RX mode writes to workqueue context (such as ndo_set_rx_mode_async or usbnet_defer_kevent()), and avoid recomputing AX_RX_CTL_DROPCRCERR from net->features outside RTNL. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261204-fcs-v4-0-3= 2773b612c81@birger-koblitz.de?part=3D1