]> git.baikalelectronics.ru Git - kernel.git/commitdiff
ethtool: eeprom: fix null-deref on genl_info in dump
authorXin Long <lucien.xin@gmail.com>
Fri, 21 Oct 2022 14:22:47 +0000 (10:22 -0400)
committerJakub Kicinski <kuba@kernel.org>
Tue, 25 Oct 2022 02:08:07 +0000 (19:08 -0700)
The similar fix as commit e36afe12ad79 ("ethtool: pse-pd: fix null-deref on
genl_info in dump") is also needed for ethtool eeprom.

Fixes: 21902f1a21a4 ("ethtool: Allow network drivers to dump arbitrary EEPROM data")
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Link: https://lore.kernel.org/r/5575919a2efc74cd9ad64021880afc3805c54166.1666362167.git.lucien.xin@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/ethtool/eeprom.c

index 1c94bb8ea03f2358a1ce68c6f8f32fe2901b6ba4..49c0a2a77f02de4d2017a30a9ea2c7d1738fd382 100644 (file)
@@ -124,7 +124,7 @@ static int eeprom_prepare_data(const struct ethnl_req_info *req_base,
        if (ret)
                goto err_free;
 
-       ret = get_module_eeprom_by_page(dev, &page_data, info->extack);
+       ret = get_module_eeprom_by_page(dev, &page_data, info ? info->extack : NULL);
        if (ret < 0)
                goto err_ops;