Skip to contentSkip to conversation

ethtool: fix missing NLM_F_MULTI flag when dumping

PATCH Applied Fernando Fernandez Mancera 3 participants 3 messages May 4, 2021 – May 5, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ethtool: fix missing NLM_F_MULTI flag when dumping

When dumping the ethtool information from all the interfaces, the netlink reply should contain the NLM_F_MULTI flag. This flag allows userspace tools to identify that multiple messages are expected.

Fixes 365f9ae ("ethtool: fix genlmsg_put() failure handling in ethnl_default_dumpit()")
---
 net/ethtool/netlink.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
net/ethtool/netlink.c +2 -1
index 290012d0d11d..88d8a0243f35 100644
@@ -387,7 +387,8 @@ static int ethnl_default_dump_one(struct sk_buff *skb, struct net_device *dev,
 	int ret;
 
 	ehdr = genlmsg_put(skb, NETLINK_CB(cb->skb).portid, cb->nlh->nlmsg_seq,
-			   &ethtool_genl_family, 0, ctx->ops->reply_cmd);
+			   &ethtool_genl_family, NLM_F_MULTI,
+			   ctx->ops->reply_cmd);
 	if (!ehdr)
 		return -EMSGSIZE;
 
Signature · 1 line
2.20.1
#1 lore raw
This patch was applied to netdev/net.git (refs/heads/master):

Hello:

This patch was applied to netdev/net.git (refs/heads/master):

Quoted 9 lines · On Wed, 5 May 2021 00:47:14 +0200 you wrote:

When dumping the ethtool information from all the interfaces, the netlink reply should contain the NLM_F_MULTI flag. This flag allows userspace tools to identify that multiple messages are expected.

Fixes 365f9ae ("ethtool: fix genlmsg_put() failure handling in ethnl_default_dumpit()")

[...]

Here is the summary with links:
- [net] ethtool: fix missing NLM_F_MULTI flag when dumping

    https://git.kernel.org/netdev/net/c/cf754ae331be

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html

#2 lore raw
In reply to Fernando Fernandez Mancera
Quoted 6 lines · Fernando Fernandez Mancera

When dumping the ethtool information from all the interfaces, the netlink reply should contain the NLM_F_MULTI flag. This flag allows userspace tools to identify that multiple messages are expected.

Fixes 365f9ae ("ethtool: fix genlmsg_put() failure handling in ethnl_default_dumpit()")

For the record, the issue was not introduced by this commit, this commit only moved the genlmsg_put() call from ethnl_default_dumpit() into ethnl_default_dump_one() but genlmsg_put() was called with zero flags since the code was introduced by commit 728480f12442 ("ethtool: default handlers for GET requests").

But as the patch has been applied already, it doesn't matter any more.

Michal

Quoted 22 lines
---
 net/ethtool/netlink.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
net/ethtool/netlink.c +2 -1
index 290012d0d11d..88d8a0243f35 100644
@@ -387,7 +387,8 @@ static int ethnl_default_dump_one(struct sk_buff *skb, struct net_device *dev,
 	int ret;
 
 	ehdr = genlmsg_put(skb, NETLINK_CB(cb->skb).portid, cb->nlh->nlmsg_seq,
-			   &ethtool_genl_family, 0, ctx->ops->reply_cmd);
+			   &ethtool_genl_family, NLM_F_MULTI,
+			   ctx->ops->reply_cmd);
 	if (!ehdr)
 		return -EMSGSIZE;
 
Signature · 1 line
2.20.1