From: Steve Wise <swise@opengridcomputing.com>
To: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
Cc: Steve Wise <swise-ut6Up61K2wZBDgjK7y7TUQ@public.gmane.org>,
Roland Dreier <roland-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
Sean Hefty <sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
Hal Rosenstock
<hal.rosenstock-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
kernel-janitors-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [patch] RDMA/cxgb3: stack info leak in iwch_craete_cq()
Date: Thu, 25 Jul 2013 18:43:28 +0000 [thread overview]
Message-ID: <51F171D0.7050204@opengridcomputing.com> (raw)
In-Reply-To: <20130725170409.GB7026-mgFCXtclrQlZLf2FXnZxJA@public.gmane.org>
On 7/25/2013 12:04 PM, Dan Carpenter wrote:
> The "uresp.reserved" field isn't initialized. It's at the end, of the
> struct here so we don't need to copy it to the user.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/drivers/infiniband/hw/cxgb3/iwch_provider.c b/drivers/infiniband/hw/cxgb3/iwch_provider.c
> index e87f220..b8e26f2 100644
> --- a/drivers/infiniband/hw/cxgb3/iwch_provider.c
> +++ b/drivers/infiniband/hw/cxgb3/iwch_provider.c
> @@ -226,7 +226,7 @@ static struct ib_cq *iwch_create_cq(struct ib_device *ibdev, int entries, int ve
> mm->len = PAGE_ALIGN(((1UL << uresp.size_log2) + 1) *
> sizeof(struct t3_cqe));
> uresp.memsize = mm->len;
> - resplen = sizeof uresp;
> + resplen = sizeof uresp - sizeof uresp.reserved;
> }
> if (ib_copy_to_udata(udata, &uresp, resplen)) {
> kfree(mm);
How did you find this?
What if, in the future, the iwch_create_cq_resp struct is changed and
stuff added to the end? I'm not sure this optimization is worth it?
WARNING: multiple messages have this Message-ID (diff)
From: Steve Wise <swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>
To: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
Cc: Steve Wise <swise-ut6Up61K2wZBDgjK7y7TUQ@public.gmane.org>,
Roland Dreier <roland-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
Sean Hefty <sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
Hal Rosenstock
<hal.rosenstock-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
kernel-janitors-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [patch] RDMA/cxgb3: stack info leak in iwch_craete_cq()
Date: Thu, 25 Jul 2013 13:43:28 -0500 [thread overview]
Message-ID: <51F171D0.7050204@opengridcomputing.com> (raw)
In-Reply-To: <20130725170409.GB7026-mgFCXtclrQlZLf2FXnZxJA@public.gmane.org>
On 7/25/2013 12:04 PM, Dan Carpenter wrote:
> The "uresp.reserved" field isn't initialized. It's at the end, of the
> struct here so we don't need to copy it to the user.
>
> Signed-off-by: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
>
> diff --git a/drivers/infiniband/hw/cxgb3/iwch_provider.c b/drivers/infiniband/hw/cxgb3/iwch_provider.c
> index e87f220..b8e26f2 100644
> --- a/drivers/infiniband/hw/cxgb3/iwch_provider.c
> +++ b/drivers/infiniband/hw/cxgb3/iwch_provider.c
> @@ -226,7 +226,7 @@ static struct ib_cq *iwch_create_cq(struct ib_device *ibdev, int entries, int ve
> mm->len = PAGE_ALIGN(((1UL << uresp.size_log2) + 1) *
> sizeof(struct t3_cqe));
> uresp.memsize = mm->len;
> - resplen = sizeof uresp;
> + resplen = sizeof uresp - sizeof uresp.reserved;
> }
> if (ib_copy_to_udata(udata, &uresp, resplen)) {
> kfree(mm);
How did you find this?
What if, in the future, the iwch_create_cq_resp struct is changed and
stuff added to the end? I'm not sure this optimization is worth it?
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2013-07-25 18:43 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-25 17:04 [patch] RDMA/cxgb3: stack info leak in iwch_craete_cq() Dan Carpenter
2013-07-25 17:04 ` Dan Carpenter
[not found] ` <20130725170409.GB7026-mgFCXtclrQlZLf2FXnZxJA@public.gmane.org>
2013-07-25 18:43 ` Steve Wise [this message]
2013-07-25 18:43 ` Steve Wise
[not found] ` <51F171D0.7050204-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>
2013-07-26 8:47 ` Dan Carpenter
2013-07-26 8:47 ` Dan Carpenter
2013-07-29 19:19 ` [patch v2] " Dan Carpenter
2013-07-29 19:19 ` Dan Carpenter
[not found] ` <20130729191914.GA11977-mgFCXtclrQlZLf2FXnZxJA@public.gmane.org>
2013-07-29 19:26 ` Steve Wise
2013-07-29 19:26 ` Steve Wise
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=51F171D0.7050204@opengridcomputing.com \
--to=swise@opengridcomputing.com \
--cc=dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org \
--cc=hal.rosenstock-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=kernel-janitors-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=roland-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=swise-ut6Up61K2wZBDgjK7y7TUQ@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.