From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0522EEC0479 for ; Tue, 3 Mar 2026 09:25:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=ECZHRdcw2yjtkhM54V5V+4EHA5UV9Qy54k8lbgSHfCE=; b=CQ6VxefbzeukdTCNbYJlssWPjr E+LUggJgBnFt0tUAKaM1WmezrfysdDkFncoJxDyAJGcsBERYGXQRgxGcrcNU8pd1uHSYl5xxTghC7 eVy2leZv5p6kjXOWO0MZVVNM5vCPWeOgNgtffFM7rwaZXktLsfUNP3LjoNYTKfVjoAtvdVYn/01Zr pUfHNvayeT91Nqz23trDxG0JeylxtkAFbvagKxp1wCx4ysixTTVbnQltyoEWgfz2SGa/b0pwGlqvb dYo2hQ2QhH8vIApBcb533XmBOP8j9wNad46ghyj01h5iXOH6vr8j8c537Ix3IBpbfh5eOOlMgClnz vjxfT0sA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1vxM0n-0000000Es62-01EB; Tue, 03 Mar 2026 09:25:53 +0000 Received: from sea.source.kernel.org ([2600:3c0a:e001:78e:0:1991:8:25]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1vxM0k-0000000Es3v-02XO; Tue, 03 Mar 2026 09:25:51 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sea.source.kernel.org (Postfix) with ESMTP id C4BFD43ED7; Tue, 3 Mar 2026 09:25:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 56996C2BC87; Tue, 3 Mar 2026 09:25:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772529948; bh=2z8ZSyC5A7LLCOOWT8EV9tuw/GmjD3s5IHXtdve+8Ug=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ZeyjEFQMukw3TU8d5tOoDLzd3ODMTrHFhlOmHqLJBRHk1ybfs/HzLXRzD8+RhvdyS EIcansrNtvHYscxkbudam4Ys/cs/RV0zLEi9KxRvWw8kk5gGWe+GcVCvChwK3EOfs6 RAK2QT394GtuMA4811HyKgLz7/60l9UPzRKs6xxDBjej/YaRRdlAB+fM+gUx8gHe2V YceWVCmdeOuRCGLYI07ztlafMcO2Lt766kX5V99XTMKJZAO1E8OQ/YclLqWthx++6F ifn/8lgvE0DIc256/bKLBh2/wLPLecfGmWkVzxUP7d3HN5wb83KcKnd08caPKt2nk+ 5ejoQlh/diXAg== Date: Tue, 3 Mar 2026 10:25:46 +0100 From: Lorenzo Bianconi To: Jakub Kicinski Cc: Felix Fietkau , Sean Wang , Andrew Lunn , "David S. Miller" , Eric Dumazet , Paolo Abeni , Matthias Brugger , AngeloGioacchino Del Regno , Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , Stanislav Fomichev , Paolo Valerio , netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, bpf@vger.kernel.org Subject: Re: [PATCH net] net: ethernet: mtk_eth_soc: Reset prog ptr to NULL in case of error in mtk_xdp_setup() Message-ID: References: <20260227-mtk-xdp-prog-ptr-fix-v1-1-b73d7588b645@kernel.org> <20260302182909.06de1942@kernel.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="yCyu0DIjJWfjcGTH" Content-Disposition: inline In-Reply-To: <20260302182909.06de1942@kernel.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260303_012550_079104_E0812625 X-CRM114-Status: GOOD ( 16.18 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org --yCyu0DIjJWfjcGTH Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable > On Fri, 27 Feb 2026 16:52:11 +0100 Lorenzo Bianconi wrote: > > --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c > > +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c > > @@ -3751,8 +3751,16 @@ static int mtk_xdp_setup(struct net_device *dev,= struct bpf_prog *prog, > > if (old_prog) > > bpf_prog_put(old_prog); > > =20 > > - if (netif_running(dev) && need_update) > > - return mtk_open(dev); > > + if (netif_running(dev) && need_update) { > > + int err; > > + > > + err =3D mtk_open(dev); > > + if (err) { > > + rcu_assign_pointer(eth->prog, NULL); > > + > > + return err; > > + } > > + } > > =20 > > return 0; >=20 > Maybe there's something special here, not obvious without context, > but why are we setting eth->prog to NULL rather than old_prog? > At the very least the commit message needs to explain.. Reviewing the code I agree, we can just restore the old program, moving bpf_prog_put() below the error condition. I will fix it in v2. Regards, Lorenzo > --=20 > pw-bot: cr --yCyu0DIjJWfjcGTH Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQTquNwa3Txd3rGGn7Y6cBh0uS2trAUCaaapGgAKCRA6cBh0uS2t rIStAP4k8YfdaIeG/OvYD60XFhFefPws3OFtIzDTK6JLsChQ5AD/eA9wJQv6eO5c T2X7PaXMz/PBi9Y7g9wayveHv1am8gc= =ljTC -----END PGP SIGNATURE----- --yCyu0DIjJWfjcGTH--