Skip to contentSkip to conversation

ethtool: pse-pd: fix null-deref on genl_info in dump

PATCH Applied Jakub Kicinski 3 participants 3 messages Oct 19, 2022 – Oct 21, 2022

Subsystems (4)
lore
Share & tools
lore

Jakub Kicinski

author maintainer
#0 lore raw

PATCH 1/1 ethtool: pse-pd: fix null-deref on genl_info in dump

ethnl_default_dump_one() passes NULL as info.

It's correct not to set extack during dump, as we should just silently skip interfaces which can't provide the information.

Reported-by [email protected]
Fixes 18ff0bcda6d1 ("ethtool: add interface to interact with Ethernet Power Equipment")

---
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]

---
 net/ethtool/pse-pd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/ethtool/pse-pd.c +1 -1
index 5a471e115b66..e8683e485dc9 100644
@@ -64,7 +64,7 @@ static int pse_prepare_data(const struct ethnl_req_info *req_base,
 	if (ret < 0)
 		return ret;
 
-	ret = pse_get_pse_attributes(dev, info->extack, data);
+	ret = pse_get_pse_attributes(dev, info ? info->extack : NULL, data);
 
 	ethnl_ops_complete(dev);
 
Signature · 1 line
2.37.3
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Jakub Kicinski

ethnl_default_dump_one() passes NULL as info.

It's correct not to set extack during dump, as we should just silently skip interfaces which can't provide the information.

Quoted 8 lines
Reported-by [email protected]
Fixes 18ff0bcda6d1 ("ethtool: add interface to interact with Ethernet Power Equipment")

---
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]

Thank you!

Quoted 21 lines
---
 net/ethtool/pse-pd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/ethtool/pse-pd.c +1 -1
index 5a471e115b66..e8683e485dc9 100644
@@ -64,7 +64,7 @@ static int pse_prepare_data(const struct ethnl_req_info *req_base,
 	if (ret < 0)
 		return ret;
 
-	ret = pse_get_pse_attributes(dev, info->extack, data);
+	ret = pse_get_pse_attributes(dev, info ? info->extack : NULL, data);
 
 	ethnl_ops_complete(dev);
 
Signature · 1 line
2.37.3
Signature · 4 lines
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
#2 lore raw
In reply to Jakub Kicinski
This patch was applied to netdev/net.git (master) by David S. Miller <[email protected]>:

Hello:

This patch was applied to netdev/net.git (master)
by David S. Miller <[email protected]>:

Quoted 10 lines · On Wed, 19 Oct 2022 15:35:51 -0700 you wrote:

ethnl_default_dump_one() passes NULL as info.

It's correct not to set extack during dump, as we should just silently skip interfaces which can't provide the information.

Reported-by [email protected]
Fixes 18ff0bcda6d1 ("ethtool: add interface to interact with Ethernet Power Equipment")

[...]

Here is the summary with links:
- [net] ethtool: pse-pd: fix null-deref on genl_info in dump

    https://git.kernel.org/netdev/net/c/46cdedf2a0fa

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html