mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/2] RDMA/nldev: Reply with the command of the request
@ 2026-11-01 14:15 Nikolaos Gkarlis
  2026-11-01 14:15 ` [PATCH 1/2] RDMA/nldev: Reply to RDMA_NLDEV_CMD_PORT_GET with its own command Nikolaos Gkarlis
  2026-11-01 14:15 ` [PATCH 2/2] RDMA/nldev: Reply to RDMA_NLDEV_CMD_STAT_DEL " Nikolaos Gkarlis
  0 siblings, 2 replies; 3+ messages in thread
From: Nikolaos Gkarlis @ 2026-11-01 14:15 UTC (permalink / raw)
  To: Jason Gunthorpe, Leon Romanovsky
  Cc: linux-rdma, linux-kernel, 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.

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
-- 
2.55.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/2] RDMA/nldev: Reply to RDMA_NLDEV_CMD_PORT_GET with its own command
  2026-11-01 14:15 [PATCH 0/2] RDMA/nldev: Reply with the command of the request Nikolaos Gkarlis
@ 2026-11-01 14:15 ` Nikolaos Gkarlis
  2026-11-01 14:15 ` [PATCH 2/2] RDMA/nldev: Reply to RDMA_NLDEV_CMD_STAT_DEL " Nikolaos Gkarlis
  1 sibling, 0 replies; 3+ messages in thread
From: Nikolaos Gkarlis @ 2026-11-01 14:15 UTC (permalink / raw)
  To: Jason Gunthorpe, Leon Romanovsky
  Cc: linux-rdma, linux-kernel, Nikolaos Gkarlis

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
Signed-off-by: Nikolaos Gkarlis <nickgarlis@gmail.com>
---
 drivers/infiniband/core/nldev.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/infiniband/core/nldev.c b/drivers/infiniband/core/nldev.c
index 849a5db54e1c..0602e4d38aa5 100644
--- a/drivers/infiniband/core/nldev.c
+++ b/drivers/infiniband/core/nldev.c
@@ -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;
-- 
2.55.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 2/2] RDMA/nldev: Reply to RDMA_NLDEV_CMD_STAT_DEL with its own command
  2026-11-01 14:15 [PATCH 0/2] RDMA/nldev: Reply with the command of the request Nikolaos Gkarlis
  2026-11-01 14:15 ` [PATCH 1/2] RDMA/nldev: Reply to RDMA_NLDEV_CMD_PORT_GET with its own command Nikolaos Gkarlis
@ 2026-11-01 14:15 ` Nikolaos Gkarlis
  1 sibling, 0 replies; 3+ messages in thread
From: Nikolaos Gkarlis @ 2026-11-01 14:15 UTC (permalink / raw)
  To: Jason Gunthorpe, Leon Romanovsky
  Cc: linux-rdma, linux-kernel, 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
Signed-off-by: Nikolaos Gkarlis <nickgarlis@gmail.com>
---
 drivers/infiniband/core/nldev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/infiniband/core/nldev.c b/drivers/infiniband/core/nldev.c
index 0602e4d38aa5..953406531cd5 100644
--- a/drivers/infiniband/core/nldev.c
+++ b/drivers/infiniband/core/nldev.c
@@ -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;
-- 
2.55.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-11-01 14:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-01 14:15 [PATCH 0/2] RDMA/nldev: Reply with the command of the request Nikolaos Gkarlis
2026-11-01 14:15 ` [PATCH 1/2] RDMA/nldev: Reply to RDMA_NLDEV_CMD_PORT_GET with its own command Nikolaos Gkarlis
2026-11-01 14:15 ` [PATCH 2/2] RDMA/nldev: Reply to RDMA_NLDEV_CMD_STAT_DEL " Nikolaos Gkarlis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®