net-sysfs: Add rtnl locking for getting Tx queue traffic class
authorAlexander Duyck <alexanderduyck@fb.com>
Mon, 8 Feb 2021 22:29:18 +0000 (14:29 -0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 8 Feb 2021 23:07:50 +0000 (15:07 -0800)
commitb2f175648031b8b22927220abd3b081f1a12e628
tree480dae4449566e4c465065a9cd26bcde1c7dcdf8
parent796c9015ab8d41a66e35fb45c61c60676fc7dc41
net-sysfs: Add rtnl locking for getting Tx queue traffic class

In order to access the suboordinate dev for a device we should be holding
the rtnl_lock when outside of the transmit path. The existing code was not
doing that for the sysfs dump function and as a result we were open to a
possible race.

To resolve that take the rtnl lock prior to accessing the sb_dev field of
the Tx queue and release it after we have retrieved the tc for the queue.

Signed-off-by: Alexander Duyck <alexanderduyck@fb.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/net-sysfs.c