net: qualcomm: rmnet: avoid stale VND access on TX drop
Subsystems (4)
PATCH v2 1/1 net: qualcomm: rmnet: avoid stale VND access on TX drop
A struct rmnet_port stores a pointer to the most recently created RMNET VND in port->rmnet_dev, but userspace can delete that VND while the port still has another attached VND. When RMNET later sends a buffered TX skb, a failure in __skb_linearize() makes rmnet_send_skb() update the drop counter through that stale pointer, which causes a UAF.
The stale pointer can also be used by rmnet_unregister_bridge() when a real device leaves bridge mode. In that case it is passed to netdev_upper_dev_unlink(), which dereferences the freed VND and leaves the actual bridge adjacency behind.
Account TX drops on the lower device and use the current bridge master instead of port->rmnet_dev when unlinking. Remove the now useless port->rmnet_dev.
---
Changes in v2:
- Strengthen the UAF fix following review by Sashiko on the v1 (https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261031221052.1642262-1-Jeremy.Jean%40oss.cyber.gouv.fr)
v1: https://lore.kernel.org/all/[email protected]/
drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c | 4 +--- drivers/net/ethernet/qualcomm/rmnet/rmnet_config.h | 1 - drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c | 5 +---- 3 files changed, 2 insertions(+), 8 deletions(-)
drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c +1 -3
@@ -96,7 +96,6 @@ static void rmnet_unregister_bridge(struct rmnet_port *port)if (port->rmnet_mode !=RMNET_EPMODE_BRIDGE )return ; - rmnet_dev = port->rmnet_dev;if (!port->nr_rmnet_devs) {/* bridge device */ real_dev = port->bridge_ep;
@@ -113,6 +112,7 @@ static void rmnet_unregister_bridge(struct rmnet_port *port) port->rmnet_mode =RMNET_EPMODE_VND ; } + rmnet_dev =netdev_master_upper_dev_get (bridge_dev);netdev_upper_dev_unlink (bridge_dev, rmnet_dev);rmnet_unregister_real_device (bridge_dev); }
@@ -163,7 +163,6 @@ static int rmnet_newlink(struct net_device *dev, goto err2; port->rmnet_mode = mode; - port->rmnet_dev = dev;hlist_add_head_rcu (&ep->hlnode, &port->muxed_ep[mux_id]);
@@ -487,7 +486,6 @@ int rmnet_add_bridge(struct net_device *rmnet_dev, slave_port =rmnet_get_port_rtnl (slave_dev); slave_port->rmnet_mode =RMNET_EPMODE_BRIDGE ; slave_port->bridge_ep = real_dev; - slave_port->rmnet_dev = rmnet_dev; port->rmnet_mode =RMNET_EPMODE_BRIDGE ; port->bridge_ep = slave_dev;
drivers/net/ethernet/qualcomm/rmnet/rmnet_config.h +0 -1
@@ -37,7 +37,6 @@ struct rmnet_port {u8 rmnet_mode;struct hlist_head muxed_ep[RMNET_MAX_LOGICAL_EP ];struct net_device *bridge_ep; -struct net_device *rmnet_dev;/* Egress aggregation information */ struct rmnet_egress_agg_params egress_agg_params;
drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c +1 -4
@@ -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 ; }
Signature · 1 line
2.47.3
[email protected]
AI reviewThis is an automated message. This series looks like a fix, but its commit messages seem to be missing some information:
Hi!
This is an automated message. This series looks like a fix, but its commit messages seem to be missing some information:
- How the issue was discovered, e.g. hit in production, hit during development, syzbot report, manual code inspection, LLM or static analysis tool scan.
- Whether the issue was actually triggered, or is only theoretical (e.g. found by code inspection). If it was triggered please include the symptoms, like the stack trace or error messages.
- What hardware the change was tested on. For driver fixes please mention the device (and if relevant firmware version) used for testing, or say that the change was not tested on real hardware.
Please do not repost the series just to address the above. Instead, reply to this email with the missing information, so that reviewers can take it into account. If the series needs another revision for other reasons, please include the information in the commit messages then.
The evaluation is done by an LLM so it may be wrong, if you think that is the case please reply and explain.
Simon Horman
reviewerQuoted 17 lines · On Sun, Nov 01, 2026 at 11:29:13PM +0000, [email protected] wrote:
Hi!
This is an automated message. This series looks like a fix, but its commit messages seem to be missing some information:
- How the issue was discovered, e.g. hit in production, hit during development, syzbot report, manual code inspection, LLM or static analysis tool scan.
- Whether the issue was actually triggered, or is only theoretical (e.g. found by code inspection). If it was triggered please include the symptoms, like the stack trace or error messages.
- What hardware the change was tested on. For driver fixes please mention the device (and if relevant firmware version) used for testing, or say that the change was not tested on real hardware.
Quoted 8 lines
Please do not repost the series just to address the above. Instead, reply to this email with the missing information, so that reviewers can take it into account. If the series needs another revision for other reasons, please include the information in the commit messages then.
The evaluation is done by an LLM so it may be wrong, if you think that is the case please reply and explain.
Hi Jérémy,
I would appreciate it if you could take a moment to respond to the questions posed by the bot above.
Quoted 116 lines
-----Original Message-----
From: Jérémy Jean <[email protected]>
Sent: Sunday, November 1, 2026 4:24 PM
To: Subash Abhinov Kasiviswanathan <[email protected]>; Sean Tranchetti <[email protected]>
Cc: [email protected]; [email protected]; Jérémy Jean <[email protected]>; [email protected]
Subject: [PATCH net v2] net: qualcomm: rmnet: avoid stale VND access on TX dropA struct
rmnet_portstores a pointer to the most recently created RMNET VND inport->rmnet_dev, but userspace can delete that VND while the port still has another attached VND. When RMNET later sends a buffered TX skb, a failure in__skb_linearize()makesrmnet_send_skb()update the drop counter through that stale pointer, which causes a UAF.The stale pointer can also be used by
rmnet_unregister_bridge()when a real device leaves bridge mode. In that case it is passed tonetdev_upper_dev_unlink(), which dereferences the freed VND and leaves the actual bridge adjacency behind.Account TX drops on the lower device and use the current bridge master instead of
port->rmnet_devwhen unlinking. Remove the now uselessport->rmnet_dev.Fixes d939b6d30bea ("net: rmnet: fix bridge mode bugs")Fixes 64b5d1f8f2d1 ("net: qualcomm: rmnet: add tx packets aggregation")Signed-off-by Jérémy Jean <[email protected]>---
Changes in v2:
- Strengthen the UAF fix following review by Sashiko on the v1
(https://netdev-
ai.bots.linux.dev/sashiko/#/patchset/20261031221052.1642262-1- Jeremy.Jean%40oss.cyber.gouv.fr)v1: https://lore.kernel.org/all/20261031221052.1642262-1-
[email protected]/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c | 4 +--- drivers/net/ethernet/qualcomm/rmnet/rmnet_config.h | 1 - drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c | 5 +---- 3 files changed, 2 insertions(+), 8 deletions(-)drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c +0
-1@@ -96,7 +96,6 @@ static void rmnet_unregister_bridge(struct rmnet_port *port)if (port->rmnet_mode !=RMNET_EPMODE_BRIDGE )return ; - rmnet_dev = port->rmnet_dev;if (!port->nr_rmnet_devs) {/* bridge device */ drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c +1
-0real_dev = port->bridge_ep;@@ -113,6 +112,7 @@ static void rmnet_unregister_bridge(struct rmnet_port *port) port->rmnet_mode = RMNET_EPMODE_VND; } + rmnet_dev =netdev_master_upper_dev_get (bridge_dev);netdev_upper_dev_unlink (bridge_dev, rmnet_dev);rmnet_unregister_real_device (bridge_dev);}
drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c +0
-2@@ -163,7 +163,6 @@ static int rmnet_newlink(struct net_device *dev, goto err2; port->rmnet_mode = mode; - port->rmnet_dev = dev;hlist_add_head_rcu (&ep->hlnode, &port->muxed_ep[mux_id]);@@ -487,7 +486,6 @@ int rmnet_add_bridge(struct net_device *rmnet_dev, slave_port =rmnet_get_port_rtnl (slave_dev); slave_port->rmnet_mode =RMNET_EPMODE_BRIDGE ; slave_port->bridge_ep = real_dev; - slave_port->rmnet_dev = rmnet_dev; port->rmnet_mode =RMNET_EPMODE_BRIDGE ; port->bridge_ep = slave_dev;drivers/net/ethernet/qualcomm/rmnet/rmnet_config.h +0
-1@@ -37,7 +37,6 @@ struct rmnet_port {u8 rmnet_mode;struct hlist_head muxed_ep[RMNET_MAX_LOGICAL_EP ];struct net_device *bridge_ep; -struct net_device *rmnet_dev;/* Egress aggregation information */ struct rmnet_egress_agg_params egress_agg_params; diff --git
a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.cb/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.cindex39d6d084e73f..bd68d60b50d3100644drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c +1
-5@@ -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 ; } --
Quoted 1 line
2.47.3
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 6 lines · On Sun, 1 Nov 2026 23:23:54 +0000 you wrote:
A struct
rmnet_portstores a pointer to the most recently created RMNET VND inport->rmnet_dev, but userspace can delete that VND while the port still has another attached VND. When RMNET later sends a buffered TX skb, a failure in__skb_linearize()makesrmnet_send_skb()update the drop counter through that stale pointer, which causes a UAF.
Quoted 6 lines
The stale pointer can also be used by
rmnet_unregister_bridge()when a real device leaves bridge mode. In that case it is passed tonetdev_upper_dev_unlink(), which dereferences the freed VND and leaves the actual bridge adjacency behind.[...]
Here is the summary with links:
- [net,v2] net: qualcomm: rmnet: avoid stale VND access on TX drop
https://git.kernel.org/netdev/net-next/c/4f89bcfa1e16
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html