In the Linux kernel, the following vulnerability has been resolved:
ethtool: check device is present when getting link settings
A sysfs reader can race with a device reset or removal, attempting to read device state when the device is not actually present. eg:
[exception RIP: qed_get_current_link+17]
#8 [ffffb9e4f2907c48] qedegetlinkksettings at ffffffffc07a994a [qede] #9 [ffffb9e4f2907cd8] _rhcallgetlinkksettings at ffffffff992b01a3 #10 [ffffb9e4f2907d38] _ethtoolgetlinkksettings at ffffffff992b04e4 #11 [ffffb9e4f2907d90] duplexshow at ffffffff99260300 #12 [ffffb9e4f2907e38] devattrshow at ffffffff9905a01c #13 [ffffb9e4f2907e50] sysfskfseqshow at ffffffff98e0145b #14 [ffffb9e4f2907e68] seqread at ffffffff98d902e3 #15 [ffffb9e4f2907ec8] vfsread at ffffffff98d657d1 #16 [ffffb9e4f2907f00] ksysread at ffffffff98d65c3f #17 [ffffb9e4f2907f38] dosyscall_64 at ffffffff98a052fb
crash> struct net_device.state ffff9a9d21336000 state = 5,
state 5 is _LINKSTATESTART (0b1) and _LINKSTATENOCARRIER (0b100). The device is not present, note lack of _LINKSTATE_PRESENT (0b10).
This is the same sort of panic as observed in commit 4224cfd7fb65 ("net-sysfs: add check for netdevice being present to speed_show").
There are many other callers of _ethtoolgetlinkksettings() which don't have a device presence check.
Move this check into ethtool to protect all callers.