suresh kumar
d15c9f6e33
net-sysfs: add check for netdevice being present to speed_show
[ Upstream commit 4224cfd7fb6523f7a9d1c8bb91bb5df1e38eb624 ]
When bringing down the netdevice or system shutdown, a panic can be
triggered while accessing the sysfs path because the device is already
removed.
[ 755.549084] mlx5_core 0000:12:00.1: Shutdown was called
[ 756.404455] mlx5_core 0000:12:00.0: Shutdown was called
...
[ 757.937260] BUG: unable to handle kernel NULL pointer dereference at (null)
[ 758.031397] IP: [<ffffffff8ee11acb>] dma_pool_alloc+0x1ab/0x280
crash> bt
...
PID: 12649 TASK: ffff8924108f2100 CPU: 1 COMMAND: "amsd"
...
#9 [ffff89240e1a38b0] page_fault at ffffffff8f38c778
[exception RIP: dma_pool_alloc+0x1ab]
RIP: ffffffff8ee11acb RSP: ffff89240e1a3968 RFLAGS: 00010046
RAX: 0000000000000246 RBX: ffff89243d874100 RCX: 0000000000001000
RDX: 0000000000000000 RSI: 0000000000000246 RDI: ffff89243d874090
RBP: ffff89240e1a39c0 R8: 000000000001f080 R9: ffff8905ffc03c00
R10: ffffffffc04680d4 R11: ffffffff8edde9fd R12: 00000000000080d0
R13: ffff89243d874090 R14: ffff89243d874080 R15: 0000000000000000
ORIG_RAX: ffffffffffffffff CS: 0010 SS: 0018
#10 [ffff89240e1a39c8] mlx5_alloc_cmd_msg at ffffffffc04680f3 [mlx5_core]
#11 [ffff89240e1a3a18] cmd_exec at ffffffffc046ad62 [mlx5_core]
#12 [ffff89240e1a3ab8] mlx5_cmd_exec at ffffffffc046b4fb [mlx5_core]
#13 [ffff89240e1a3ae8] mlx5_core_access_reg at ffffffffc0475434 [mlx5_core]
#14 [ffff89240e1a3b40] mlx5e_get_fec_caps at ffffffffc04a7348 [mlx5_core]
#15 [ffff89240e1a3bb0] get_fec_supported_advertised at ffffffffc04992bf [mlx5_core]
#16 [ffff89240e1a3c08] mlx5e_get_link_ksettings at ffffffffc049ab36 [mlx5_core]
#17 [ffff89240e1a3ce8] __ethtool_get_link_ksettings at ffffffff8f25db46
#18 [ffff89240e1a3d48] speed_show at ffffffff8f277208
#19 [ffff89240e1a3dd8] dev_attr_show at ffffffff8f0b70e3
#20 [ffff89240e1a3df8] sysfs_kf_seq_show at ffffffff8eedbedf
#21 [ffff89240e1a3e18] kernfs_seq_show at ffffffff8eeda596
#22 [ffff89240e1a3e28] seq_read at ffffffff8ee76d10
#23 [ffff89240e1a3e98] kernfs_fop_read at ffffffff8eedaef5
#24 [ffff89240e1a3ed8] vfs_read at ffffffff8ee4e3ff
#25 [ffff89240e1a3f08] sys_read at ffffffff8ee4f27f
#26 [ffff89240e1a3f50] system_call_fastpath at ffffffff8f395f92
crash> net_device.state ffff89443b0c0000
state = 0x5 (__LINK_STATE_START| __LINK_STATE_NOCARRIER)
To prevent this scenario, we also make sure that the netdevice is present.
Signed-off-by: suresh kumar <suresh2514@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-03-16 14:16:00 +01:00
..
2020-09-25 13:58:01 -07:00
2021-02-17 11:02:28 +01:00
2019-03-27 13:49:44 -07:00
2020-09-28 15:00:15 -07:00
2021-03-07 12:34:07 +01:00
2022-01-27 10:54:30 +01:00
2022-01-27 10:54:34 +01:00
2022-02-23 12:01:02 +01:00
2021-12-08 09:03:22 +01:00
2021-03-30 14:32:05 +02:00
2019-04-10 22:12:26 -07:00
2019-10-04 11:10:56 -07:00
2021-12-08 09:03:21 +01:00
2022-03-02 11:42:48 +01:00
2021-09-18 13:40:22 +02:00
2021-09-18 13:40:30 +02:00
2021-01-27 11:55:23 +01:00
2020-04-28 14:39:46 -07:00
2020-11-25 11:28:12 -08:00
2019-06-09 19:40:10 -07:00
2021-08-18 08:59:13 +02:00
2020-12-07 11:53:40 -08:00
2022-01-11 15:25:00 +01:00
2019-12-12 17:07:05 -08:00
2021-12-14 11:32:43 +01:00
2022-01-27 10:54:33 +01:00
2022-02-01 17:25:44 +01:00
2022-03-16 14:16:00 +01:00
2020-02-26 20:07:25 -08:00
2019-06-19 11:23:13 -04:00
2020-04-21 15:44:30 -07:00
2019-05-30 11:26:32 -07:00
2020-11-18 11:04:11 -08:00
2020-05-09 20:59:21 -07:00
2021-05-19 10:13:17 +02:00
2021-03-07 12:34:09 +01:00
2020-08-19 16:07:49 -07:00
2019-10-13 10:13:08 -07:00
2022-02-23 12:01:02 +01:00
2020-07-13 11:03:44 -07:00
2020-05-08 15:32:17 +10:00
2022-03-08 19:09:32 +01:00
2022-03-08 19:09:32 +01:00
2020-09-30 11:50:35 -07:00
2021-12-17 10:14:41 +01:00
2021-01-23 16:03:59 +01:00
2021-11-26 10:39:14 +01:00
2021-11-18 14:04:08 +01:00
2021-11-18 14:03:42 +01:00
2019-12-25 19:51:33 -08:00
2020-06-18 20:46:23 -07:00
2020-01-24 20:54:30 +01:00
2021-04-14 08:42:09 +02:00