From: Jason Gunthorpe <jgg@ziepe.ca>
To: Greg KH <gregkh@linuxfoundation.org>
Cc: Leon Romanovsky <leon@kernel.org>,
Dan Carpenter <dan.carpenter@oracle.com>,
Haimin Zhang <tcs.kernel@gmail.com>,
Weihang Li <liweihang@huawei.com>,
Wenpeng Liang <liangwenpeng@huawei.com>,
Xiaofei Tan <tanxiaofei@huawei.com>,
YueHaibing <yuehaibing@huawei.com>,
Sean Hefty <sean.hefty@intel.com>,
Don Hiatt <don.hiatt@intel.com>, Ira Weiny <ira.weiny@intel.com>,
Doug Ledford <dledford@redhat.com>,
Dasaratharaman Chandramouli
<dasaratharaman.chandramouli@intel.com>,
linux-rdma@vger.kernel.org, security@kernel.org
Subject: Re: [PATCH] RDMA/ucma: fix a kernel-infoleak in ucma_init_qp_attr()
Date: Thu, 3 Feb 2022 14:41:32 -0400 [thread overview]
Message-ID: <20220203184132.GC8034@ziepe.ca> (raw)
In-Reply-To: <YfwfYfogp69yg1rF@kroah.com>
On Thu, Feb 03, 2022 at 07:30:57PM +0100, Greg KH wrote:
> On Thu, Feb 03, 2022 at 08:26:16PM +0200, Leon Romanovsky wrote:
> > On Thu, Feb 03, 2022 at 09:14:47PM +0300, Dan Carpenter wrote:
> > > From: Haimin Zhang <tcs.kernel@gmail.com>
> > >
> > > The ib_copy_ah_attr_to_user() function only initializes "resp.grh" if
> > > the "resp.is_global" flag is set. Unfortunately, this data is copied to
> > > the user and copying uninitialized stack data to the user is an
> > > information leak. Zero out the whole struct to be safe.
> > >
> > > Fixes: 4ba66093bdc6 ("IB/core: Check for global flag when using ah_attr")
> > > Reported-by: TCS Robot <tcs_robot@tencent.com>
> > > Signed-off-by: Haimin Zhang <tcs.kernel@gmail.com>
> > > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> > > Resending through the regular lists.
> > >
> > > I added parentheses around the sizeof to make checkpatch happy.
> > > s/sizeof resp/sizeof(resp)/.
> > >
> > > drivers/infiniband/core/ucma.c | 2 +-
> > > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > The change is ok, but I prefer to initialize to zero as early as possible.
> >
> > diff --git a/drivers/infiniband/core/ucma.c b/drivers/infiniband/core/ucma.c
> > index 2b72c4fa9550..6d801ed2e46b 100644
> > +++ b/drivers/infiniband/core/ucma.c
> > @@ -1211,9 +1211,9 @@ static ssize_t ucma_init_qp_attr(struct ucma_file *file,
> > int in_len, int out_len)
> > {
> > struct rdma_ucm_init_qp_attr cmd;
> > - struct ib_uverbs_qp_attr resp;
> > + struct ib_uverbs_qp_attr resp = {};
> > struct ucma_context *ctx;
> > - struct ib_qp_attr qp_attr;
> > + struct ib_qp_attr qp_attr = {};
>
> Will that catch all of the padding in the structure? This seems to come
> up a lot and I never remember...
Yes, last time you asked we went over it.
Jason
prev parent reply other threads:[~2022-02-03 18:41 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-03 18:14 [PATCH] RDMA/ucma: fix a kernel-infoleak in ucma_init_qp_attr() Dan Carpenter
2022-02-03 18:26 ` Leon Romanovsky
2022-02-03 18:30 ` Greg KH
2022-02-03 18:41 ` Jason Gunthorpe [this message]
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=20220203184132.GC8034@ziepe.ca \
--to=jgg@ziepe.ca \
--cc=dan.carpenter@oracle.com \
--cc=dasaratharaman.chandramouli@intel.com \
--cc=dledford@redhat.com \
--cc=don.hiatt@intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=ira.weiny@intel.com \
--cc=leon@kernel.org \
--cc=liangwenpeng@huawei.com \
--cc=linux-rdma@vger.kernel.org \
--cc=liweihang@huawei.com \
--cc=sean.hefty@intel.com \
--cc=security@kernel.org \
--cc=tanxiaofei@huawei.com \
--cc=tcs.kernel@gmail.com \
--cc=yuehaibing@huawei.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox