Skip to contentSkip to conversation

net: ethtool: phy: Check the req_info.pdn field for GET commands

PATCH Applied Maxime Chevallier 3 participants 6 messages Sep 10, 2024 – Sep 12, 2024

Subsystems (4)
lore
Share & tools
lore

Maxime Chevallier

author maintainer
#0 lore raw

PATCH 1/1 net: ethtool: phy: Check the req_info.pdn field for GET commands

When processing the netlink GET requests to get PHY info, the req_info.pdn pointer is NULL when no PHY matches the requested parameters, such as when the phy_index is invalid, or there's simply no PHY attached to the interface.

Therefore, check the req_info.pdn pointer for NULL instead of dereferencing it.

---
Hi,

I'm targetting net-next as the commit this patch fixes is still in net-next.

 net/ethtool/phy.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/ethtool/phy.c +1 -1
index 560dd039c662..4ef7c6e32d10 100644
@@ -164,7 +164,7 @@ int ethnl_phy_doit(struct sk_buff *skb, struct genl_info *info)
 		goto err_unlock_rtnl;
 
 	/* No PHY, return early */
-	if (!req_info.pdn->phy)
+	if (!req_info.pdn)
 		goto err_unlock_rtnl;
 
 	ret = ethnl_phy_reply_size(&req_info.base, info->extack);
Signature · 1 line
2.46.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Maxime Chevallier

When processing the netlink GET requests to get PHY info, the req_info.pdn pointer is NULL when no PHY matches the requested parameters, such as when the phy_index is invalid, or there's simply no PHY attached to the interface.

Therefore, check the req_info.pdn pointer for NULL instead of dereferencing it.

Quoted 6 lines

---

Thanks, there is another issue found by syzbot BTW (one imbalanced netdev_put())

author maintainer
#2 lore raw

Hi Eric,

Quoted 11 lines · On Wed, 11 Sep 2024 09:26:23 +0200 Eric Dumazet <[email protected]> wrote:
Quoted 9 lines · Maxime Chevallier

When processing the netlink GET requests to get PHY info, the req_info.pdn pointer is NULL when no PHY matches the requested parameters, such as when the phy_index is invalid, or there's simply no PHY attached to the interface.

Therefore, check the req_info.pdn pointer for NULL instead of dereferencing it.

Quoted 8 lines
Quoted 6 lines

---

Thanks, there is another issue found by syzbot BTW (one imbalanced netdev_put())

Sorry for asking that, but I missed the report from this current patch, as well as the one you're referring to. I've looked-up the netdev archive and the syzbot web interface [1] and found no reports for both issues. I am clearly not looking at the right place, and/or I probably need to open my eyes a bit more.

Can you point me to the report in question ?

[1] : https://syzkaller.appspot.com/upstream/s/net

Quoted 2 lines

Thanks for the review,

Maxime

author maintainer
#3 lore raw

Hi,

Quoted 5 lines · On Wed, 11 Sep 2024 10:33:22 +0200 Maxime Chevallier…

Sorry for asking that, but I missed the report from this current patch, as well as the one you're referring to. I've looked-up the netdev archive and the syzbot web interface [1] and found no reports for both issues. I am clearly not looking at the right place, and/or I probably need to open my eyes a bit more.

Heh my bad, I just received the report in question. Looks like you are getting these before I do :)

Thanks,

Maxime

#4 lore raw
Quoted 7 lines · Maxime Chevallier

Hi,

On Wed, 11 Sep 2024 10:33:22 +0200
Maxime Chevallier <[email protected]> wrote:

Quoted 8 lines
Quoted 5 lines

Sorry for asking that, but I missed the report from this current patch, as well as the one you're referring to. I've looked-up the netdev archive and the syzbot web interface [1] and found no reports for both issues. I am clearly not looking at the right place, and/or I probably need to open my eyes a bit more.

Heh my bad, I just received the report in question. Looks like you are getting these before I do :)

I triage the reports, to avoid flooding mailing list with duplicates, and possibly catch very serious security bugs.

I usually wait for some consistent signal like a repro, so that a single email is sent to the list.

#5 lore raw
In reply to Maxime Chevallier
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 9 lines · On Tue, 10 Sep 2024 19:46:35 +0200 you wrote:

When processing the netlink GET requests to get PHY info, the req_info.pdn pointer is NULL when no PHY matches the requested parameters, such as when the phy_index is invalid, or there's simply no PHY attached to the interface.

Therefore, check the req_info.pdn pointer for NULL instead of dereferencing it.

[...]

Here is the summary with links:
- [net-next] net: ethtool: phy: Check the req_info.pdn field for GET commands

    https://git.kernel.org/netdev/net-next/c/fce1e9f86af1

You are awesome, thank you!

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