Skip to contentSkip to conversation

IB/hfi1: info leak in get_ctxt_info()

PATCH Superseded Dan Carpenter 3 participants 5 messages Sep 16, 2015 – Sep 18, 2015 1 message not in the archive

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

PATCH 1/1 IB/hfi1: info leak in get_ctxt_info()

The cinfo struct has a hole after the last struct member so we need to zero it out. Otherwise we don't disclose some uninitialized stack data.

drivers/staging/rdma/hfi1/file_ops.c +1 -0
index 4698617..2c43ca5 100644
@@ -1181,6 +1181,7 @@ static int get_ctxt_info(struct file *fp, void __user *ubase, __u32 len)
 	struct hfi1_filedata *fd = fp->private_data;
 	int ret = 0;
 
+	memset(&cinfo, 0, sizeof(cinfo));
 	ret = hfi1_get_base_kinfo(uctxt, &cinfo);
 	if (ret < 0)
 		goto done;
#1 lore raw
Quoted 2 lines · Dan Carpenter

The cinfo struct has a hole after the last struct member so we need to zero it out. Otherwise we don't disclose some uninitialized stack data.

I think the "don't" wasn't intended in the second sentence?

julia

Quoted 20 lines
drivers/staging/rdma/hfi1/file_ops.c +1 -1
index 4698617..2c43ca5 100644
@@ -1181,6 +1181,7 @@ static int get_ctxt_info(struct file *fp, void __user *ubase, __u32 len)
 	struct hfi1_filedata *fd = fp->private_data;
 	int ret = 0;
 
+	memset(&cinfo, 0, sizeof(cinfo));
 	ret = hfi1_get_base_kinfo(uctxt, &cinfo);
 	if (ret < 0)
 		goto done;
--

To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): alpine.DEB.2.02.1509160824370.2049-bi+AKbBUZKagILUCTcTcHdKyNwTtLsGr@public.gmane.org

#3 lore raw
Quoted 7 lines · Julia Lawall
Quoted 2 lines · Dan Carpenter

The cinfo struct has a hole after the last struct member so we need to zero it out. Otherwise we don't disclose some uninitialized stack data.

I think the "don't" wasn't intended in the second sentence?

Derp... I will resend.

regards,
dan carpenter

#4 lore raw

PATCH v2 1/1 IB/hfi1: info leak in get_ctxt_info()

In reply to Julia Lawall

The cinfo struct has a hole after the last struct member so we need to zero it out. Otherwise we disclose some uninitialized stack data.

---
v2: typo in changelog

drivers/staging/rdma/hfi1/file_ops.c +1 -0
index 4698617..2c43ca5 100644
@@ -1181,6 +1181,7 @@ static int get_ctxt_info(struct file *fp, void __user *ubase, __u32 len)
 	struct hfi1_filedata *fd = fp->private_data;
 	int ret = 0;
 
+	memset(&cinfo, 0, sizeof(cinfo));
 	ret = hfi1_get_base_kinfo(uctxt, &cinfo);
 	if (ret < 0)
 		goto done;