Skip to contentSkip to conversation

RDMA/nldev: Reply with the command of the request

PATCH Applied Nikolaos Gkarlis 3 participants 6 messages Nov 1 – Nov 3 InfiniBand

lore
Share & tools
lore
#0 lore raw

cover RDMA/nldev: Reply with the command of the request

Two doit handlers reply with another command's message type:
RDMA_NLDEV_CMD_PORT_GET with RDMA_NLDEV_CMD_GET, and RDMA_NLDEV_CMD_STAT_DEL with RDMA_NLDEV_CMD_STAT_SET. A client that decodes replies based on their type mis-decodes them. AFAIK iproute2 igores the reply type and rdma-core does not use these commands. I spotted these when writing an RDMA netlink client for Go.

I used AI to prepare the patches but I reviewed and tested myself.

Nikolaos Gkarlis (2):
RDMA/nldev: Reply to RDMA_NLDEV_CMD_PORT_GET with its own command RDMA/nldev: Reply to RDMA_NLDEV_CMD_STAT_DEL with its own command

 drivers/infiniband/core/nldev.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

base-commit: c3e8e9451e6f1b69f685b75e0fbf14f3d0fb2539

Signature · 1 line
2.55.0
#1 lore raw

PATCH 1/2 RDMA/nldev: Reply to RDMA_NLDEV_CMD_PORT_GET with its own command

nldev_port_get_doit() replies with RDMA_NLDEV_CMD_GET, while the dump replies with RDMA_NLDEV_CMD_PORT_GET. Use RDMA_NLDEV_CMD_PORT_GET for both.

Fixes c3f66f7b0052 ("RDMA/netlink: Implement nldev port doit callback")
Assisted-by LLM
---
 drivers/infiniband/core/nldev.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/infiniband/core/nldev.c +2 -1
index 849a5db54e1c..0602e4d38aa5 100644
@@ -1304,7 +1304,8 @@ static int nldev_port_get_doit(struct sk_buff *skb, struct nlmsghdr *nlh,
 	}
 
 	nlh = nlmsg_put(msg, NETLINK_CB(skb).portid, nlh->nlmsg_seq,
-			RDMA_NL_GET_TYPE(RDMA_NL_NLDEV, RDMA_NLDEV_CMD_GET),
+			RDMA_NL_GET_TYPE(RDMA_NL_NLDEV,
+					 RDMA_NLDEV_CMD_PORT_GET),
 			0, 0);
 	if (!nlh) {
 		err = -EMSGSIZE;
Signature · 1 line
2.55.0
#2 lore raw

Re: [PATCH 1/2] RDMA/nldev: Reply to RDMA_NLDEV_CMD_PORT_GET with its own command

Sashiko has reviewed this patch and found no issues.
Quoted 7 lines

nldev_port_get_doit() replies with RDMA_NLDEV_CMD_GET, while the dump replies with RDMA_NLDEV_CMD_PORT_GET. Use RDMA_NLDEV_CMD_PORT_GET for both.

Fixes c3f66f7b0052 ("RDMA/netlink: Implement nldev port doit callback")
Assisted-by LLM

Sashiko has reviewed this patch and found no issues.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
#3 lore raw

PATCH 2/2 RDMA/nldev: Reply to RDMA_NLDEV_CMD_STAT_DEL with its own command

In reply to Nikolaos Gkarlis

nldev_stat_del_doit() replies with RDMA_NLDEV_CMD_STAT_SET. Use RDMA_NLDEV_CMD_STAT_DEL.

Fixes b389327df905 ("RDMA/nldev: Allow counter manual mode configration through RDMA netlink")
Assisted-by LLM
---
 drivers/infiniband/core/nldev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/core/nldev.c +1 -1
index 0602e4d38aa5..953406531cd5 100644
@@ -2316,7 +2316,7 @@ static int nldev_stat_del_doit(struct sk_buff *skb, struct nlmsghdr *nlh,
 	}
 	nlh = nlmsg_put(msg, NETLINK_CB(skb).portid, nlh->nlmsg_seq,
 			RDMA_NL_GET_TYPE(RDMA_NL_NLDEV,
-					 RDMA_NLDEV_CMD_STAT_SET),
+					 RDMA_NLDEV_CMD_STAT_DEL),
 			0, 0);
 	if (!nlh) {
 		ret = -EMSGSIZE;
Signature · 1 line
2.55.0
#4 lore raw

Re: [PATCH 2/2] RDMA/nldev: Reply to RDMA_NLDEV_CMD_STAT_DEL with its own command

Sashiko has reviewed this patch and found no issues.
Quoted 6 lines

nldev_stat_del_doit() replies with RDMA_NLDEV_CMD_STAT_SET. Use RDMA_NLDEV_CMD_STAT_DEL.

Fixes b389327df905 ("RDMA/nldev: Allow counter manual mode configration through RDMA netlink")
Assisted-by LLM

Sashiko has reviewed this patch and found no issues.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
#5 lore raw
In reply to Nikolaos Gkarlis
Quoted 8 lines · Nikolaos Gkarlis

Two doit handlers reply with another command's message type:
RDMA_NLDEV_CMD_PORT_GET with RDMA_NLDEV_CMD_GET, and RDMA_NLDEV_CMD_STAT_DEL with RDMA_NLDEV_CMD_STAT_SET. A client that decodes replies based on their type mis-decodes them. AFAIK iproute2 igores the reply type and rdma-core does not use these commands. I spotted these when writing an RDMA netlink client for Go.

[...]

Applied, thanks!

[1/2] RDMA/nldev: Reply to RDMA_NLDEV_CMD_PORT_GET with its own command

      https://git.kernel.org/rdma/rdma/c/8cf5406b86249a
[2/2] RDMA/nldev: Reply to RDMA_NLDEV_CMD_STAT_DEL with its own command
      https://git.kernel.org/rdma/rdma/c/f3980f8abd2d11

Best regards,

Signature · 1 line
Leon Romanovsky <[email protected]>