Message ID | 20210606142422.1589376-1-idosch@idosch.org (mailing list archive) |
---|---|
State | Accepted |
Commit | 51c96a561f244e25a4a2afc7a48b92b4adf8050d |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [net] ethtool: Fix NULL pointer dereference during module EEPROM dump | expand |
Context | Check | Description |
---|---|---|
netdev/cover_letter | success | Link |
netdev/fixes_present | success | Link |
netdev/patch_count | success | Link |
netdev/tree_selection | success | Clearly marked for net |
netdev/subject_prefix | success | Link |
netdev/cc_maintainers | success | CCed 6 of 6 maintainers |
netdev/source_inline | success | Was 0 now: 0 |
netdev/verify_signedoff | success | Link |
netdev/module_param | success | Was 0 now: 0 |
netdev/build_32bit | success | Errors and warnings before: 39 this patch: 39 |
netdev/kdoc | success | Errors and warnings before: 0 this patch: 0 |
netdev/verify_fixes | success | Link |
netdev/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 8 lines checked |
netdev/build_allmodconfig_warn | success | Errors and warnings before: 32 this patch: 32 |
netdev/header_inline | success | Link |
On 6/6/2021 5:24 PM, Ido Schimmel wrote: > From: Ido Schimmel <idosch@nvidia.com> > > 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: c97a31f66ebc ("ethtool: wire in generic SFP module access") > Signed-off-by: Ido Schimmel <idosch@nvidia.com> > --- > net/ethtool/eeprom.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/net/ethtool/eeprom.c b/net/ethtool/eeprom.c > index 2a6733a6449a..5d38e90895ac 100644 > --- a/net/ethtool/eeprom.c > +++ b/net/ethtool/eeprom.c > @@ -95,7 +95,7 @@ static int get_module_eeprom_by_page(struct net_device *dev, > if (dev->sfp_bus) > return sfp_get_module_eeprom_by_page(dev->sfp_bus, page_data, extack); > > - if (ops->get_module_info) > + if (ops->get_module_eeprom_by_page) > return ops->get_module_eeprom_by_page(dev, page_data, extack); > > return -EOPNOTSUPP; > -- > 2.31.1 Acked-by: Moshe Shemesh <moshe@nvidia.com>
Hello: This patch was applied to netdev/net.git (refs/heads/master): On Sun, 6 Jun 2021 17:24:22 +0300 you wrote: > From: Ido Schimmel <idosch@nvidia.com> > > 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(). > > [...] Here is the summary with links: - [net] ethtool: Fix NULL pointer dereference during module EEPROM dump https://git.kernel.org/netdev/net/c/51c96a561f24 You are awesome, thank you! -- Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html
diff --git a/net/ethtool/eeprom.c b/net/ethtool/eeprom.c index 2a6733a6449a..5d38e90895ac 100644 --- a/net/ethtool/eeprom.c +++ b/net/ethtool/eeprom.c @@ -95,7 +95,7 @@ static int get_module_eeprom_by_page(struct net_device *dev, if (dev->sfp_bus) return sfp_get_module_eeprom_by_page(dev->sfp_bus, page_data, extack); - if (ops->get_module_info) + if (ops->get_module_eeprom_by_page) return ops->get_module_eeprom_by_page(dev, page_data, extack); return -EOPNOTSUPP;