linux-stable/net/ethtool
Ido Schimmel 51c96a561f ethtool: Fix NULL pointer dereference during module EEPROM dump
When get_module_eeprom_by_page() is not implemented by the driver, NULL
pointer dereference can occur [1].

Fix by testing if get_module_eeprom_by_page() is implemented instead of
get_module_info().

[1]
 BUG: kernel NULL pointer dereference, address: 0000000000000000
 [...]
 CPU: 0 PID: 251 Comm: ethtool Not tainted 5.13.0-rc3-custom-00940-g3822d0670c9d #989
 Call Trace:
  eeprom_prepare_data+0x101/0x2d0
  ethnl_default_doit+0xc2/0x290
  genl_family_rcv_msg_doit+0xdc/0x140
  genl_rcv_msg+0xd7/0x1d0
  netlink_rcv_skb+0x49/0xf0
  genl_rcv+0x1f/0x30
  netlink_unicast+0x1f6/0x2c0
  netlink_sendmsg+0x1f9/0x400
  __sys_sendto+0xe1/0x130
  __x64_sys_sendto+0x1b/0x20
  do_syscall_64+0x3a/0x70
  entry_SYSCALL_64_after_hwframe+0x44/0xae

Fixes: c97a31f66e ("ethtool: wire in generic SFP module access")
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Acked-by: Moshe Shemesh <moshe@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2021-06-07 13:10:34 -07:00
..
bitset.c ethtool: fix stack overflow in ethnl_parse_bitset() 2020-12-09 15:50:38 -08:00
bitset.h ethtool: add ethnl_parse_bitset() helper 2020-03-12 15:32:32 -07:00
cabletest.c ethtool: link up ethnl_header_policy as a nested policy 2020-10-06 06:25:55 -07:00
channels.c ethtool: fix the check logic of at least one channel for RX/TX 2021-02-28 11:49:07 -08:00
coalesce.c ethtool: link up ethnl_header_policy as a nested policy 2020-10-06 06:25:55 -07:00
common.c ethtool: Add lanes parameter for ETHTOOL_LINK_MODE_10000baseR_FEC_BIT 2021-04-07 14:53:04 -07:00
common.h net: ethtool: Export helpers for getting EEPROM info 2021-04-11 16:34:56 -07:00
debug.c ethtool: link up ethnl_header_policy as a nested policy 2020-10-06 06:25:55 -07:00
eee.c ethtool: fix incorrect datatype in set_eee ops 2021-04-06 16:42:25 -07:00
eeprom.c ethtool: Fix NULL pointer dereference during module EEPROM dump 2021-06-07 13:10:34 -07:00
features.c ethtool: netlink: add missing netdev_features_change() call 2020-11-09 17:15:34 -08:00
fec.c ethtool: add FEC statistics 2021-04-15 17:08:29 -07:00
ioctl.c ethtool: ioctl: Fix out-of-bounds warning in store_link_ksettings_for_user() 2021-04-19 15:27:37 -07:00
linkinfo.c ethtool: link up ethnl_header_policy as a nested policy 2020-10-06 06:25:55 -07:00
linkmodes.c ethtool: Expose the number of lanes in use 2021-02-03 18:37:29 -08:00
linkstate.c ethtool: link up ethnl_header_policy as a nested policy 2020-10-06 06:25:55 -07:00
Makefile ethtool: add a new command for reading standard stats 2021-04-16 16:59:20 -07:00
netlink.c ethtool: fix missing NLM_F_MULTI flag when dumping 2021-05-05 12:41:10 -07:00
netlink.h Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2021-04-17 11:08:07 -07:00
pause.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2021-04-17 11:08:07 -07:00
privflags.c ethtool: link up ethnl_header_policy as a nested policy 2020-10-06 06:25:55 -07:00
rings.c ethtool: link up ethnl_header_policy as a nested policy 2020-10-06 06:25:55 -07:00
stats.c ethtool: stats: Fix a copy-paste error 2021-05-19 11:57:33 -07:00
strset.c ethtool: add interface to read RMON stats 2021-04-16 16:59:20 -07:00
tsinfo.c ethtool: link up ethnl_header_policy as a nested policy 2020-10-06 06:25:55 -07:00
tunnels.c ethtool: link up ethnl_header_policy as a nested policy 2020-10-06 06:25:55 -07:00
wol.c ethtool: link up ethnl_header_policy as a nested policy 2020-10-06 06:25:55 -07:00