From: Antoine Tenart <atenart@kernel.org> Date: 2021-12-07 14:57:34
Hello,
Those two patches allow to track the Rx and Tx queue count at
unregistration and help in detecting illegal addition of Tx queues after
unregister (a warning is added).
This follows discussions on the following thread,
https://lore.kernel.org/all/20211122162007.303623-1-atenart@kernel.org/T/
A patch fixing one issue linked to this was merged ealier,
https://lore.kernel.org/all/20211203101318.435618-1-atenart@kernel.org/T/
Thanks,
Antoine
Antoine Tenart (2):
net-sysfs: update the queue counts in the unregistration path
net-sysfs: warn if new queue objects are being created during device
unregistration
net/core/net-sysfs.c | 10 ++++++++++
1 file changed, 10 insertions(+)
--
2.33.1
From: Antoine Tenart <atenart@kernel.org> Date: 2021-12-07 14:57:36
When updating Rx and Tx queue kobjects, the queue count should always be
updated to match the queue kobjects count. This was not done in the net
device unregistration path, fix it. Tracking all queue count updates
will allow in a following up patch to detect illegal updates.
Signed-off-by: Antoine Tenart <atenart@kernel.org>
---
net/core/net-sysfs.c | 3 +++
1 file changed, 3 insertions(+)
From: Antoine Tenart <atenart@kernel.org> Date: 2021-12-07 14:57:38
Calling netdev_queue_update_kobjects is allowed during device
unregistration since commit 5c56580b74e5 ("net: Adjust TX queue kobjects
if number of queues changes during unregister"). But this is solely to
allow queue unregistrations. Any path attempting to add new queues after
a device started its unregistration should be fixed.
This patch adds a warning to detect such illegal use.
Signed-off-by: Antoine Tenart <atenart@kernel.org>
---
net/core/net-sysfs.c | 7 +++++++
1 file changed, 7 insertions(+)
@@ -1694,6 +1694,13 @@ netdev_queue_update_kobjects(struct net_device *dev, int old_num, int new_num)inti;interror=0;+/* Tx queue kobjects are allowed to be updated when a device is being+*unregistered,butsolelytoremovequeuesfromqdiscs.Anypath+*addingqueuesshouldbefixed.+*/+WARN(dev->reg_state==NETREG_UNREGISTERING&&new_num>old_num,+"New queues can't be registered after device unregistration.");+for(i=old_num;i<new_num;i++){error=netdev_queue_add_kobject(dev,i);if(error){
Hello:
This series was applied to netdev/net-next.git (master)
by Jakub Kicinski [off-list ref]:
On Tue, 7 Dec 2021 15:57:23 +0100 you wrote:
Hello,
Those two patches allow to track the Rx and Tx queue count at
unregistration and help in detecting illegal addition of Tx queues after
unregister (a warning is added).
This follows discussions on the following thread,
https://lore.kernel.org/all/20211122162007.303623-1-atenart@kernel.org/T/
[...]