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 7638F37BE88; Mon, 9 Feb 2026 14:40:07 +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=1770648008; cv=none; b=bGsYieEvp67J9FB0RhuaKMR8bOki3RAVOgNBGF6zslGhgx1GBTgPzvxK5wbb+KGCwOaKn3FNDNS8VFkVkJC/PHy1Bqs/EYSW4PwraiOekO1XFWmpLKGoaWKj38bgs8kdSq6RAN93gsS0f7s/gfKfJh3b+2rCVzeEOxj7JtUhbuE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770648008; c=relaxed/simple; bh=Q+GQ6p+bzAih5sjZsnsdu5xbQBsSOab34CA6MsW/V+E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bPVgxYvmGcP98pMPlo5ma8mkSxr4YvZO8ZTsK/uogzDvH0LqYEs0dZcmIYYPgoOo9/aIpVwyFs0Dq4AAHzWVsGNMqs0BKtWowluy6/dOFcgbYF7nnt1OQtooUBG+9mJP5KkCwuvmQLK5n+/TdIvzFZpTEMzjbMUnfusGFjG9ENA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=bZo4yThJ; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="bZo4yThJ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 60B05C116C6; Mon, 9 Feb 2026 14:40:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1770648007; bh=Q+GQ6p+bzAih5sjZsnsdu5xbQBsSOab34CA6MsW/V+E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bZo4yThJ9ufiPjhIHPw5siLmQ6wIbjYd+92ZiRzfhfULuevaTaoIoSyY/GFMr2SAz pNg3txQF7s2grjZLdnsVfZDRze+rkY7L8bsTiwEsKS2RxWjygnnAfWjf0Odi+wZS6L KzeGZLCfbvxoyTj5p1uTOkWfZ4byZ4duWzj2jJDk= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Gal Pressman , Martin KaFai Lau , Daniel Borkmann , Eric Dumazet , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.12 092/113] net: dont touch dev->stats in BPF redirect paths Date: Mon, 9 Feb 2026 15:24:01 +0100 Message-ID: <20260209142313.487820267@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260209142310.204833231@linuxfoundation.org> References: <20260209142310.204833231@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jakub Kicinski [ Upstream commit fdf3f6800be36377e045e2448087f12132b88d2f ] Gal reports that BPF redirect increments dev->stats.tx_errors on failure. This is not correct, most modern drivers completely ignore dev->stats so these drops will be invisible to the user. Core code should use the dedicated core stats which are folded into device stats in dev_get_stats(). Note that we're switching from tx_errors to tx_dropped. Core only has tx_dropped, hence presumably users already expect that counter to increment for "stack" Tx issues. Reported-by: Gal Pressman Link: https://lore.kernel.org/c5df3b60-246a-4030-9c9a-0a35cd1ca924@nvidia.com Fixes: b4ab31414970 ("bpf: Add redirect_neigh helper as redirect drop-in") Acked-by: Martin KaFai Lau Acked-by: Daniel Borkmann Reviewed-by: Eric Dumazet Link: https://patch.msgid.link/20260130033827.698841-1-kuba@kernel.org Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- net/core/filter.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/net/core/filter.c b/net/core/filter.c index bc61ad5f4e054..06e179865a21b 100644 --- a/net/core/filter.c +++ b/net/core/filter.c @@ -2297,12 +2297,12 @@ static int __bpf_redirect_neigh_v6(struct sk_buff *skb, struct net_device *dev, err = bpf_out_neigh_v6(net, skb, dev, nh); if (unlikely(net_xmit_eval(err))) - DEV_STATS_INC(dev, tx_errors); + dev_core_stats_tx_dropped_inc(dev); else ret = NET_XMIT_SUCCESS; goto out_xmit; out_drop: - DEV_STATS_INC(dev, tx_errors); + dev_core_stats_tx_dropped_inc(dev); kfree_skb(skb); out_xmit: return ret; @@ -2404,12 +2404,12 @@ static int __bpf_redirect_neigh_v4(struct sk_buff *skb, struct net_device *dev, err = bpf_out_neigh_v4(net, skb, dev, nh); if (unlikely(net_xmit_eval(err))) - DEV_STATS_INC(dev, tx_errors); + dev_core_stats_tx_dropped_inc(dev); else ret = NET_XMIT_SUCCESS; goto out_xmit; out_drop: - DEV_STATS_INC(dev, tx_errors); + dev_core_stats_tx_dropped_inc(dev); kfree_skb(skb); out_xmit: return ret; -- 2.51.0