From: Leon Romanovsky <leon@kernel.org>
To: Aditya Pakki <pakki001@umn.edu>
Cc: kjlu@umn.edu, Michal Kalderon <Michal.Kalderon@cavium.com>,
Ariel Elior <Ariel.Elior@cavium.com>,
Doug Ledford <dledford@redhat.com>,
Jason Gunthorpe <jgg@ziepe.ca>,
linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] infiniband/qedr: Potential null ptr dereference of qp
Date: Tue, 25 Dec 2018 06:26:10 +0200 [thread overview]
Message-ID: <20181225042610.GC10329@mtr-leonro.mtl.com> (raw)
In-Reply-To: <20181224182445.21256-1-pakki001@umn.edu>
[-- Attachment #1: Type: text/plain, Size: 1046 bytes --]
On Mon, Dec 24, 2018 at 12:24:45PM -0600, Aditya Pakki wrote:
> idr_find() may fail and return a NULL pointer. The fix checks the
> return value of the function and returns an error in case of NULL.
>
> Signed-off-by: Aditya Pakki <pakki001@umn.edu>
> ---
> drivers/infiniband/hw/qedr/qedr_iw_cm.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/infiniband/hw/qedr/qedr_iw_cm.c b/drivers/infiniband/hw/qedr/qedr_iw_cm.c
> index 505fa3648762..93b16237b767 100644
> --- a/drivers/infiniband/hw/qedr/qedr_iw_cm.c
> +++ b/drivers/infiniband/hw/qedr/qedr_iw_cm.c
> @@ -492,6 +492,8 @@ int qedr_iw_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
> int i;
>
> qp = idr_find(&dev->qpidr.idr, conn_param->qpn);
> + if (unlikely(!qp))
> + return -EINVAL;
As was already pointed, qedr is racy in their accesses to idr_find() and
NULL pointer is less worry about their IDR code.
>
> laddr = (struct sockaddr_in *)&cm_id->m_local_addr;
> raddr = (struct sockaddr_in *)&cm_id->m_remote_addr;
> --
> 2.17.1
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]
next prev parent reply other threads:[~2018-12-25 4:26 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-24 18:24 [PATCH] infiniband/qedr: Potential null ptr dereference of qp Aditya Pakki
2018-12-25 4:26 ` Leon Romanovsky [this message]
2018-12-25 13:13 ` [EXT] " Michal Kalderon
2019-01-02 23:28 ` 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=20181225042610.GC10329@mtr-leonro.mtl.com \
--to=leon@kernel.org \
--cc=Ariel.Elior@cavium.com \
--cc=Michal.Kalderon@cavium.com \
--cc=dledford@redhat.com \
--cc=jgg@ziepe.ca \
--cc=kjlu@umn.edu \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=pakki001@umn.edu \
/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