Skip to contentSkip to conversation

net: qualcomm: rmnet: fix TX aggregation teardown race

PATCH Applied Jérémy Jean 5 participants 7 messages Nov 1 – Nov 10

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: qualcomm: rmnet: fix TX aggregation teardown race

There is a race in rmnet_unregister_real_device() because it cancels TX aggregation before unregistering the rx handler. A transmit that already obtained the port through rmnet_get_port_rcu() can wait on port->agg_lock, then create a new aggregate and rearm the timer after rmnet_map_tx_aggregate_exit() has drained it. The timer can later queue work on the freed port.

Unregister the rx handler first so that no reader can rearm aggregation after rmnet_map_tx_aggregate_exit() drains it.

Fixes 64b5d1f8f2d1 ("net: qualcomm: rmnet: add tx packets aggregation")
---
 drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c +2 -2
index 61b04c6c0390..2ff4b9519139 100644
@@ -40,10 +40,10 @@ static int rmnet_unregister_real_device(struct net_device *real_dev)
 	if (port->nr_rmnet_devs)
 		return -EINVAL;
 
-	rmnet_map_tx_aggregate_exit(port);
-
 	netdev_rx_handler_unregister(real_dev);
 
+	rmnet_map_tx_aggregate_exit(port);
+
 	kfree(port);
 
 	netdev_dbg(real_dev, "Removed from rmnet\n");
Signature · 1 line
2.47.3
#1 lore raw
This 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.

reviewer
#2 lore raw
Quoted 17 lines · On Sun, Nov 01, 2026 at 11:39:11PM +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,

As per similar requests for other patches, I would appreciate it if you could take a moment to respond to the questions posed by the bot above.

#3 lore raw
Quoted 24 lines · Simon Horman
Quoted 23 lines · On Sun, Nov 01, 2026 at 11:39:11PM +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.

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.

Quoted 7 lines
Quoted 2 lines

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,

As per similar requests for other patches, I would appreciate it if you could take a moment to respond to the questions posed by the bot above.

* The bug was found by LLM-assisted code review.
* The bug was triggered by a software reproducer with a KASAN enabled kernel under QEMU VM.
* It has not been tested on real hardware.

reviewer Reviewed-by
#4 lore raw
Quoted 31 lines · Jérémy Jean
Quoted 30 lines · Simon Horman
Quoted 17 lines · On Sun, Nov 01, 2026 at 11:39:11PM +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,

Quoted 7 lines
Quoted 2 lines

As per similar requests for other patches, I would appreciate it if you could take a moment to respond to the questions posed by the bot above.

* The bug was found by LLM-assisted code review.
* The bug was triggered by a software reproducer with a KASAN enabled kernel under QEMU VM.
* It has not been tested on real hardware.

Thanks for the update Jérémy, much appreciated.

maintainer Reviewed-by on v1 1/1
#5 lore raw
In reply to Jérémy Jean
Quoted 45 lines

-----Original Message-----
From: Jérémy Jean <[email protected]>
Sent: Sunday, November 1, 2026 4:34 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] net: qualcomm: rmnet: fix TX aggregation teardown race

There is a race in rmnet_unregister_real_device() because it cancels TX aggregation before unregistering the rx handler. A transmit that already obtained the port through rmnet_get_port_rcu() can wait on port->agg_lock, then create a new aggregate and rearm the timer after rmnet_map_tx_aggregate_exit() has drained it. The timer can later queue work on the freed port.

Unregister the rx handler first so that no reader can rearm aggregation after rmnet_map_tx_aggregate_exit() drains it.

Fixes 64b5d1f8f2d1 ("net: qualcomm: rmnet: add tx packets aggregation")
---
 drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c +2 -2
index 61b04c6c0390..2ff4b9519139 100644
@@ -40,10 +40,10 @@ static int rmnet_unregister_real_device(struct
 net_device *real_dev)
 	if (port->nr_rmnet_devs)
 		return -EINVAL;
 
-	rmnet_map_tx_aggregate_exit(port);
-
 	netdev_rx_handler_unregister(real_dev);
 
+	rmnet_map_tx_aggregate_exit(port);
+
 	kfree(port);
 
Quoted 3 lines

netdev_dbg(real_dev, "Removed from rmnet\n");
--
2.47.3

#6 lore raw
In reply to Jérémy Jean
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 8 lines · On Sun, 1 Nov 2026 23:34:28 +0000 you wrote:

There is a race in rmnet_unregister_real_device() because it cancels TX aggregation before unregistering the rx handler. A transmit that already obtained the port through rmnet_get_port_rcu() can wait on port->agg_lock, then create a new aggregate and rearm the timer after rmnet_map_tx_aggregate_exit() has drained it. The timer can later queue work on the freed port.

[...]

Here is the summary with links:
- [net] net: qualcomm: rmnet: fix TX aggregation teardown race

    https://git.kernel.org/netdev/net-next/c/0af0e210b5bd

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html