All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@ziepe.ca>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Doug Ledford <dledford@redhat.com>,
	Matan Barak <matanb@mellanox.com>,
	Yishai Hadas <yishaih@mellanox.com>,
	Leon Romanovsky <leon@kernel.org>,
	Shamir Rabinovitch <shamir.rabinovitch@oracle.com>,
	Michael Guralnik <michaelgur@mellanox.com>,
	Matthew Wilcox <willy@infradead.org>,
	linux-rdma@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH v2] uverbs: prevent potential underflow
Date: Tue, 22 Oct 2019 15:15:58 -0300	[thread overview]
Message-ID: <20191022181558.GA18115@ziepe.ca> (raw)
In-Reply-To: <20191011133419.GA22905@mwanda>

On Fri, Oct 11, 2019 at 04:34:19PM +0300, Dan Carpenter wrote:
> The issue is in drivers/infiniband/core/uverbs_std_types_cq.c in the
> UVERBS_HANDLER(UVERBS_METHOD_CQ_CREATE) function.  We check that:
> 
>         if (attr.comp_vector >= attrs->ufile->device->num_comp_vectors) {
> 
> But we don't check that "attr.comp_vector" whether negative.  It
> could potentially lead to an array underflow.  My concern would be where
> cq->vector is used in the create_cq() function from the cxgb4 driver.
> 
> And really "attr.comp_vector" is appears as a u32 to user space so that's
> the right type to use.
> 
> Fixes: 9ee79fce3642 ("IB/core: Add completion queue (cq) object actions")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> v2: Change both types to u32
> 
>  drivers/infiniband/core/uverbs.h | 2 +-
>  include/rdma/ib_verbs.h          | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)

Applied to for-rc, thanks

Jason

WARNING: multiple messages have this Message-ID (diff)
From: Jason Gunthorpe <jgg@ziepe.ca>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Doug Ledford <dledford@redhat.com>,
	Matan Barak <matanb@mellanox.com>,
	Yishai Hadas <yishaih@mellanox.com>,
	Leon Romanovsky <leon@kernel.org>,
	Shamir Rabinovitch <shamir.rabinovitch@oracle.com>,
	Michael Guralnik <michaelgur@mellanox.com>,
	Matthew Wilcox <willy@infradead.org>,
	linux-rdma@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH v2] uverbs: prevent potential underflow
Date: Tue, 22 Oct 2019 18:15:58 +0000	[thread overview]
Message-ID: <20191022181558.GA18115@ziepe.ca> (raw)
In-Reply-To: <20191011133419.GA22905@mwanda>

On Fri, Oct 11, 2019 at 04:34:19PM +0300, Dan Carpenter wrote:
> The issue is in drivers/infiniband/core/uverbs_std_types_cq.c in the
> UVERBS_HANDLER(UVERBS_METHOD_CQ_CREATE) function.  We check that:
> 
>         if (attr.comp_vector >= attrs->ufile->device->num_comp_vectors) {
> 
> But we don't check that "attr.comp_vector" whether negative.  It
> could potentially lead to an array underflow.  My concern would be where
> cq->vector is used in the create_cq() function from the cxgb4 driver.
> 
> And really "attr.comp_vector" is appears as a u32 to user space so that's
> the right type to use.
> 
> Fixes: 9ee79fce3642 ("IB/core: Add completion queue (cq) object actions")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> v2: Change both types to u32
> 
>  drivers/infiniband/core/uverbs.h | 2 +-
>  include/rdma/ib_verbs.h          | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)

Applied to for-rc, thanks

Jason

  reply	other threads:[~2019-10-22 18:16 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-05  5:23 [PATCH] uverbs: prevent potential underflow Dan Carpenter
2019-10-05  5:23 ` Dan Carpenter
2019-10-08 19:44 ` Jason Gunthorpe
2019-10-08 19:44   ` Jason Gunthorpe
2019-10-09  7:35   ` Dan Carpenter
2019-10-09  7:35     ` Dan Carpenter
2019-10-11 13:34   ` [PATCH v2] " Dan Carpenter
2019-10-11 13:34     ` Dan Carpenter
2019-10-22 18:15     ` Jason Gunthorpe [this message]
2019-10-22 18:15       ` Jason Gunthorpe

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=20191022181558.GA18115@ziepe.ca \
    --to=jgg@ziepe.ca \
    --cc=dan.carpenter@oracle.com \
    --cc=dledford@redhat.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=leon@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=matanb@mellanox.com \
    --cc=michaelgur@mellanox.com \
    --cc=shamir.rabinovitch@oracle.com \
    --cc=willy@infradead.org \
    --cc=yishaih@mellanox.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 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.