Skip to contentSkip to conversation

netdev-genl: avoid empty messages in queue dump

PATCH Applied Jakub Kicinski 4 participants 5 messages Dec 18, 2024 – Dec 19, 2024

Subsystems (2)
lore
Share & tools
lore

Jakub Kicinski

author maintainer
#0 lore raw

PATCH 1/1 netdev-genl: avoid empty messages in queue dump

Empty netlink responses from do() are not correct (as opposed to dump() where not dumping anything is perfectly fine). We should return an error if the target object does not exist, in this case if the netdev is down it has no queues.

Fixes 6b6171db7fc8 ("netdev-genl: Add netlink framework functions for queue")
Reported-by [email protected]

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

---
 net/core/netdev-genl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
net/core/netdev-genl.c +2 -2
index 9527dd46e4dc..b4becd4065d9 100644
@@ -430,10 +430,10 @@ static int
 netdev_nl_queue_fill(struct sk_buff *rsp, struct net_device *netdev, u32 q_idx,
 		     u32 q_type, const struct genl_info *info)
 {
-	int err = 0;
+	int err;
 
 	if (!(netdev->flags & IFF_UP))
-		return err;
+		return -ENOENT;
 
 	err = netdev_nl_queue_validate(netdev, q_idx, q_type);
 	if (err)
Signature · 1 line
2.47.1
author maintainer
#1 lore raw
Quoted 4 lines · On Tue, 17 Dec 2024 18:25:08 -0800 Jakub Kicinski wrote:

Subject: [PATCH net] netdev-genl: avoid empty messages in queue dump

Empty netlink responses from do() are not correct (as opposed to dump() where not dumping anything is perfectly fine).

Well.. I shouldn't have said "dump" in the subject, then. Let's see how the review goes, I can adjust when applying.

Reviewed-by on v1 1/1
#2 lore raw
In reply to Jakub Kicinski
Quoted 9 lines · Jakub Kicinski

Empty netlink responses from do() are not correct (as opposed to dump() where not dumping anything is perfectly fine). We should return an error if the target object does not exist, in this case if the netdev is down it has no queues.

Fixes 6b6171db7fc8 ("netdev-genl: Add netlink framework functions for queue")
Reported-by [email protected]
Reviewed-by on v1 1/1
#3 lore raw
In reply to Jakub Kicinski
Quoted 24 lines · Jakub Kicinski

Empty netlink responses from do() are not correct (as opposed to dump() where not dumping anything is perfectly fine). We should return an error if the target object does not exist, in this case if the netdev is down it has no queues.

Fixes 6b6171db7fc8 ("netdev-genl: Add netlink framework functions for queue")
Reported-by [email protected]

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

---
 net/core/netdev-genl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
net/core/netdev-genl.c +0 -0
index 9527dd46e4dc..b4becd4065d9 100644
@@ -430,10 +430,10 @@ static int
 netdev_nl_queue_fill(struct sk_buff *rsp, struct net_device *netdev, u32 q_idx,
 		     u32 q_type, const struct genl_info *info)

net/core/netdev-genl.c static int · line 439

Quoted 10 lines
net/core/netdev-genl.c +2 -2
 {
-	int err = 0;
+	int err;
 
 	if (!(netdev->flags & IFF_UP))
-		return err;
+		return -ENOENT;
 
 	err = netdev_nl_queue_validate(netdev, q_idx, q_type);
 	if (err)
#4 lore raw
In reply to Jakub Kicinski
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:

Hello:

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

Quoted 10 lines · On Tue, 17 Dec 2024 18:25:08 -0800 you wrote:

Empty netlink responses from do() are not correct (as opposed to dump() where not dumping anything is perfectly fine). We should return an error if the target object does not exist, in this case if the netdev is down it has no queues.

Fixes 6b6171db7fc8 ("netdev-genl: Add netlink framework functions for queue")
Reported-by [email protected]

[...]

Here is the summary with links:
- [net] netdev-genl: avoid empty messages in queue dump

    https://git.kernel.org/netdev/net/c/5eb70dbebf32

You are awesome, thank you!

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