mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/1] RDMA/core: Don't copy uninitialized stack memory to userspace
@ 2020-06-09  8:40 Xidong Wang
  2020-06-09  9:20 ` Gal Pressman
  0 siblings, 1 reply; 2+ messages in thread
From: Xidong Wang @ 2020-06-09  8:40 UTC (permalink / raw)
  To: Xidong Wang, Doug Ledford, Jason Gunthorpe, Yishai Hadas,
	Leon Romanovsky, Max Gurtovoy, Maor Gottlieb, linux-rdma,
	linux-kernel

From: xidongwang <wangxidong_97@163.com>

ib_uverbs_create_ah() may copy stack allocated
structs to userspace without initializing all members of these
structs. Clear out this memory to prevent information leaks.

Signed-off-by: xidongwang <wangxidong_97@163.com>
---
 drivers/infiniband/core/uverbs_cmd.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c
index b48b3f6..04861e6 100644
--- a/drivers/infiniband/core/uverbs_cmd.c
+++ b/drivers/infiniband/core/uverbs_cmd.c
@@ -2481,6 +2481,7 @@ static int ib_uverbs_create_ah(struct uverbs_attr_bundle *attrs)
 	uobj->user_handle = cmd.user_handle;
 	uobj->object = ah;
 
+	memset(&resp, 0, sizeof(resp));
 	resp.ah_handle = uobj->id;
 
 	ret = uverbs_response(attrs, &resp, sizeof(resp));
-- 
2.7.4


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

end of thread, other threads:[~2020-06-09  9:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-09  8:40 [PATCH 1/1] RDMA/core: Don't copy uninitialized stack memory to userspace Xidong Wang
2020-06-09  9:20 ` Gal Pressman

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®