Netdev List
 help / color / mirror / Atom feed
From: Antonio Quartulli <antonio@mandelbit.com>
To: netdev@vger.kernel.org
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>
Subject: [PATCH net 5/6] net: qualcomm: rmnet: account linearization failures on the real device
Date: Thu, 26 Nov 2026 17:32:18 +0100	[thread overview]
Message-ID: <20261126163219.1744750-6-antonio@mandelbit.com> (raw)
In-Reply-To: <20261126163219.1744750-1-antonio@mandelbit.com>

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


  parent reply	other threads:[~2026-11-26 16:32 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-26 16:32 [PATCH net 0/6] net: qualcomm: rmnet: fix TX aggregation and teardown bugs Antonio Quartulli
2026-11-26 16:32 ` [PATCH net 1/6] net: qualcomm: rmnet: recheck the aggregate after flushing it Antonio Quartulli
2026-11-26 16:32 ` [PATCH net 2/6] net: qualcomm: rmnet: always arm the flush timer for a new aggregate Antonio Quartulli
2026-11-26 16:32 ` [PATCH net 3/6] net: qualcomm: rmnet: fix TX aggregation timeout overflow on 32-bit Antonio Quartulli
2026-11-26 16:32 ` [PATCH net 4/6] net: qualcomm: rmnet: stop TX aggregation after detaching the port Antonio Quartulli
2026-11-26 16:32 ` Antonio Quartulli [this message]
2026-11-26 16:32 ` [PATCH net 6/6] net: qualcomm: rmnet: unlink the bridge from the vnd it is attached to Antonio Quartulli
2026-11-26 16:47 ` [PATCH net 0/6] net: qualcomm: rmnet: fix TX aggregation and teardown bugs Antonio Quartulli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261126163219.1744750-6-antonio@mandelbit.com \
    --to=antonio@mandelbit.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=ap420073@gmail.com \
    --cc=davem@davemloft.net \
    --cc=dnlplm@gmail.com \
    --cc=edumazet@kernel.org \
    --cc=koen.vandeputte@citymesh.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sean.tranchetti@oss.qualcomm.com \
    --cc=subash.a.kasiviswanathan@oss.qualcomm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox