All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH for-next] RDMA/uverbs: Zero the QP attrs in ib_uverbs_query_qp
@ 2026-11-04 20:02 Selvin Xavier
  2026-11-04 14:47 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Selvin Xavier @ 2026-11-04 20:02 UTC (permalink / raw)
  To: leon, jgg
  Cc: linux-rdma, andrew.gospodarek, kalesh-anakkur.purayil,
	Selvin Xavier

ib_uverbs_query_qp() allocates qp_attr and qp_init_attr without zeroing
and copies fields such as alt_ah_attr, path_mig_state and sq_draining
to userspace. Drivers are not required to set every field in their
query_qp() callback, so uninitialized kernel heap memory can leak.

Allocate both structures zeroed.

Fixes: 7ccc9a24e012 ("IB/uverbs: Support for query QP from userspace")
Signed-off-by: Selvin Xavier <selvin.xavier@broadcom.com>
---
 drivers/infiniband/core/uverbs_cmd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c
index aca7c6ab55cd..54da98431f40 100644
--- a/drivers/infiniband/core/uverbs_cmd.c
+++ b/drivers/infiniband/core/uverbs_cmd.c
@@ -1668,8 +1668,8 @@ static int ib_uverbs_query_qp(struct uverbs_attr_bundle *attrs)
 	if (ret)
 		return ret;
 
-	attr = kmalloc_obj(*attr);
-	init_attr = kmalloc_obj(*init_attr);
+	attr = kzalloc_obj(*attr);
+	init_attr = kzalloc_obj(*init_attr);
 	if (!attr || !init_attr) {
 		ret = -ENOMEM;
 		goto out;
-- 
2.39.3


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

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

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-04 20:02 [PATCH for-next] RDMA/uverbs: Zero the QP attrs in ib_uverbs_query_qp Selvin Xavier
2026-11-04 14:47 ` sashiko-bot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.