🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #23174

[PATCH net 5/6] net: qualcomm: rmnet: account linearization failures on the real device

#23174
From: Antonio Quartulli
Date: Thu, 26 Nov 2026 16:32
48 lines
11150 bytes
When the real device lacks NETIF_F_FRAGLIST and linearizing an
aggregate fails, rmnet_send_skb() counts the drop on port->rmnet_dev.
That is the vnd created last on the port, never updated when it is
deleted, so it may point to a freed net_device.

The aggregate head is sized for tx-aggr-max-bytes, so linearizing only
allocates when that limit grows while an aggregate is pending.
Reproducer:

  ip link add v0 mtu 16000 type veth peer name v1 mtu 16000
  ethtool -K v0 tx-scatter-gather-fraglist off
  ip link add link v0 name rmnet1 type rmnet mux_id 1
  ip link add link v0 name rmnet2 type rmnet mux_id 2
  ethtool -C rmnet1 tx-aggr-max-frames 64 tx-aggr-time-usecs 2000
  ip link del rmnet2

then flood UDP through rmnet1 with failslab on the senders (task-filter,
probability 10) while switching tx-aggr-max-bytes between 512 and
12288. KASAN reports a use-after-free in rmnet_send_skb().

Count the drop on the real device, where it happens: the aggregate may
hold packets from any vnd.

Fixes: 64b5d1f8f2d1 ("net: qualcomm: rmnet: add tx packets aggregation")
Signed-off-by: Antonio Quartulli <antonio@mandelbit.com>
---
 drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c
index b156e864535f..3de093198474 100644
--- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c
+++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c
@@ -543,10 +543,7 @@ static void rmnet_send_skb(struct rmnet_port *port, struct sk_buff *skb)
 {
 	if (skb_needs_linearize(skb, port->dev->features)) {
 		if (unlikely(__skb_linearize(skb))) {
-			struct rmnet_priv *priv;
-
-			priv = netdev_priv(port->rmnet_dev);
-			this_cpu_inc(priv->pcpu_stats->stats.tx_drops);
+			dev_core_stats_tx_dropped_inc(port->dev);
 			dev_kfree_skb_any(skb);
 			return;
 		}
-- 
2.56.1
Technical Details
Message-ID: <20261126163219.1744750-6-antonio@mandelbit.com>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-372231-linux-kernel-netdev=dewy.ru
References: <20261126163219.1744750-1-antonio@mandelbit.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-372231-linux-kernel-netdev=dewy.ru
From: antonio@mandelbit.com (Antonio Quartulli)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net 5/6] net: qualcomm: rmnet: account linearization failures on the real device
Date: Thu, 26 Nov 2026 17:32:18 +0100
Organization: Usenet Network
Message-ID: <20261126163219.1744750-6-antonio@mandelbit.com>
References: <20261126163219.1744750-1-antonio@mandelbit.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="508797"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:FFG86g7W1xGTE2xTzCrZDN6gxlw= sha256:T9lT1E1on5vWDKFd6J0Fq6NHuBSprErpSSfgrpJQwbs=
	sha1:Hb0fiqTUsLJE52hHG7cIywP9hKw= sha256:3rVWTcK/gKcOza4qKVKI2UFyVmgcrGSLwaQjco0IWH4=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id B8D1D125EEB; Thu, 26 Nov 2026 19:33:27 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.051
X-Spam-Status: No, score=-3.051 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=mandelbit.com
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id lvvXhpv7AM2Y;
	Thu, 26 Nov 2026 19:33:24 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-372231-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=mandelbit.com
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 97B39125EED; Thu, 26 Nov 2026 19:33:16 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id F4009414D3; Thu, 26 Nov 2026 16:32:37 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1795710757;
	b=gZPgOdbiHQJhOlL5h1kBoEHIBZM2osYc7Wu8OSLRtNaw2x74qwBnv7CskvsuKBPbuBuD
	 JLrINX+L/OoOcSuyzj/iST1UtFg2LUZeLfLYX7qzy0jx7M0krTGEBuxNMGs02rkj/pL9V
	 0+YPL+29DtRQbg0CFGpPCdHcN57/Iy5WDkhyhKaXjcrBpr32YbSwgq7ecLphCGFAx6Q/A
	 DgQYKEHDkgD/77tNJKLyT59G2KAuSYRvnZDRBV4gBtWMWoAzJN258FMCzms8UT2/17pii
	 SzDZY5DZcIU/mjDZ5517F/4T4ZJ6cIs7RjwVNR2ArTFqPqeqQMDd+f5u8ZF8Ykfmmhg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795710757;
	h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:From:To:
	 Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References:
	 X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
	 List-Unsubscribe:List-Owner:Precedence:MIME-Version:
	 Content-Transfer-Encoding:X-Rspamd-Queue-Id;
	bh=lf3c8lGbqr/K5l9flE2IxkmfeNdaCQKFVrpnpEtHLeI=;
	b=GpQ8zKtcqKUJO9cQHHGrzqxRhUDWbtqvl//7xxbiqlrUWLzrpzNjJHa/WQdiNISNW0MX
	 jEuezNivHXk8cJBWFkoG7NoZDiCom9Qsu3fW0u2QLhk1mhd4OlfQMqWR97MALJ1NC916q
	 2aVTl41rjq7haC2d0LdHUy54SpmLdWsNRuEnKTVt0pcMVf0Po3P7j3c4PQgxH1QZmFHPL
	 nyNVIQvwQ3r0cQpaBIM0qKj2I7ezz/Q0NfDNIj8QP83/DFphmD4yFv9Vbb29cSsNg/U8e
	 xSfh1Keu0Xf16LLJY98NKcD6SUQJn+urwh3dEOuXcDmkaVvGtDakFsUwsCo0kDI92fA==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=mandelbit.com header.i=@mandelbit.com header.a=rsa-sha256 header.s=MBO0001 header.b=XVAKWa1C;
	dmarc=none header.from=mandelbit.com;
	spf=pass smtp.mailfrom=mandelbit.com;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id CA789606A31E;
	Thu, 26 Nov 2026 16:32:37 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key, unprotected) header.d=mandelbit.com header.i=@mandelbit.com header.a=rsa-sha256 header.s=MBO0001 header.b=XVAKWa1C
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=195.10.208.61
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1795710757;
	b=Ic7MWhz4subR5TYAY2h+8835P+4c0+a6l4AW//fbHkhXgFe+hWvkuC69JRXiHGp1qG0T
	 0NaVwCCL6fLVyDgsahjfhtKJffpc4NQoQtLoUPOWvE5Ni1ffIPqLxheW9VHW2m6PLq3Bo
	 YuG3cGT9Xx/8Nud+INq2uohCtwXqQvPjDZN4Mv27nqBgtQ+tOsfnKxe8cdzIgc2MA5ZD+
	 Onb8n+bW4osfUcB83Htg8Fey3oRu/4cY2WMcI0sHvyUo5xwfD0mLNtlIil/3j/JFUtsZp
	 9BwZwe9Xj/lAMdomG63Z1RHq+OCaYAfxI21IIGFmfTB6IcTvlZfBrC6jlH4GVre6s0g==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795710757;
	h=DMARC-Filter:Received:DKIM-Signature:From:To:Cc:Subject:Date:
	 Message-ID:X-Mailer:In-Reply-To:References:MIME-Version:
	 Content-Transfer-Encoding:X-Rspamd-Queue-Id;
	bh=lf3c8lGbqr/K5l9flE2IxkmfeNdaCQKFVrpnpEtHLeI=;
	b=rZruMqgbPcvuhnYFlscyZyCZzQMXa36yptLdY9W92vtKnd6fnyi8RDdp+JToyuiH2Tpe
	 uVuX9nxGL6v47qYht27yfz6wokb5f7E26rRAFynr0eV/M7a/B7x6vXd2FXVbo5RbKIpNw
	 2tIbIooCwy2UPnmlOw5mobBVHekpQTW7qP5+4uuY8ZVuzOC1TDbsJUqf84FflkC1BU9dc
	 XnIy7Ar8ASATvCjsosvAwfvDyDbfwrNklwZ89Ta1ximzz9r9DHY+RgQF877EFt98k8ozb
	 NtRpIYaPgwnviUjpbJd2AstfUkbriJ3lFmKHstE2EMgyB/DNmUvosghQq4y17OztzGA==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=none header.from=mandelbit.com;
	spf=pass smtp.mailfrom=mandelbit.com;
	dkim=pass header.d=mandelbit.com header.i=@mandelbit.com header.a=rsa-sha256 header.s=MBO0001 header.b=XVAKWa1C;
	arc=none smtp.remote-ip=195.10.208.61
X-Received: from mout-b-201.mailbox.org (mout-b-201.mailbox.org [195.10.208.61])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 73273606A327
	for <netdev@vger.kernel.org>; Thu, 26 Nov 2026 16:32:36 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 73273606A327
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=mandelbit.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mandelbit.com
X-Received: from smtp1.mailbox.org (smtp1.mailbox.org [IPv6:2001:67c:2050:b231:465::1])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519MLKEM768 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(No client certificate requested)
	by mout-b-201.mailbox.org (Postfix) with ESMTPS id 4jb2C00QZKzLmJ3;
	Thu, 26 Nov 2026 17:32:28 +0100 (CET)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandelbit.com;
	s=MBO0001; t=1795710748;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:cc:mime-version:mime-version:
	 content-transfer-encoding:content-transfer-encoding:
	 in-reply-to:in-reply-to:references:references;
	bh=lf3c8lGbqr/K5l9flE2IxkmfeNdaCQKFVrpnpEtHLeI=;
	b=XVAKWa1C3G5DJrhDDixAnTPqGwnp9P0YTv4LTOomBMAS5G0inkiu/AOk2JhIz8ASnjUpKE
	Q5oqy0x758/z4ohzaX9kYjc5HF+fpL00PyaQQkicnfCjtIqqefCRuJynAKguwZNuoP2jeW
	QIKkhwLoX5FWVqoaqiRRDI/0DWwjXaxj1adtl1Zc6iNsPOWloLB1mlE/BGwIgvbHBXjAU9
	ubrKg1XKJICw18tgu2mkpSBFQj1mcEWvWxm9gO1reN4nBWVl9yzVbZpMwU9PX5ov9aHB0P
	H5kVoTFm+tzwiGNVdJjfl4yr/dJHnqo2MCoT3YZPV7nDn9dLZyUBgdgcoNinMQ==
X-Authentication-Results: outgoing_mbo_mout;
	dkim=none;
	spf=pass (outgoing_mbo_mout: domain of antonio@mandelbit.com designates 2001:67c:2050:b231:465::1 as permitted sender) smtp.mailfrom=antonio@mandelbit.com
X-Cc: Subash Abhinov Kasiviswanathan <subash.a.kasiviswanathan@oss.qualcomm.com>,
	Sean Tranchetti <sean.tranchetti@oss.qualcomm.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>,
	Paolo Abeni <pabeni@redhat.com>,
	Daniele Palmas <dnlplm@gmail.com>,
	Taehee Yoo <ap420073@gmail.com>,
	koen.vandeputte@citymesh.com,
	Antonio Quartulli <antonio@mandelbit.com>
X-Mailer: git-send-email 2.56.1
X-In-Reply-To: <20261126163219.1744750-1-antonio@mandelbit.com>
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list
X-Rspamd-Queue-Id: 4jb2C00QZKzLmJ3