diff mbox

IB/hfi1: info leak in get_ctxt_info()

Message ID 20150916062142.GB21542@mwanda (mailing list archive)
State Superseded
Headers show

Commit Message

Dan Carpenter Sept. 16, 2015, 6:21 a.m. UTC
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.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Julia Lawall Sept. 16, 2015, 6:25 a.m. UTC | #1
On Wed, 16 Sep 2015, Dan Carpenter wrote:

> 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

> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/drivers/staging/rdma/hfi1/file_ops.c b/drivers/staging/rdma/hfi1/file_ops.c
> index 4698617..2c43ca5 100644
> --- a/drivers/staging/rdma/hfi1/file_ops.c
> +++ b/drivers/staging/rdma/hfi1/file_ops.c
> @@ -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 majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Dan Carpenter Sept. 16, 2015, 6:41 a.m. UTC | #2
On Wed, Sep 16, 2015 at 08:25:00AM +0200, Julia Lawall wrote:
> On Wed, 16 Sep 2015, Dan Carpenter wrote:
> 
> > 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

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/staging/rdma/hfi1/file_ops.c b/drivers/staging/rdma/hfi1/file_ops.c
index 4698617..2c43ca5 100644
--- a/drivers/staging/rdma/hfi1/file_ops.c
+++ b/drivers/staging/rdma/hfi1/file_ops.c
@@ -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;