linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Jason Gunthorpe <jgg@ziepe.ca>
Cc: michal.kalderon@marvell.com, linux-rdma@vger.kernel.org
Subject: Re: [bug report] RDMA/qedr: Add doorbell overflow recovery support
Date: Thu, 7 Nov 2019 14:40:10 +0300	[thread overview]
Message-ID: <20191107114009.GL21796@kadam> (raw)
In-Reply-To: <20191106153857.GB15851@ziepe.ca>

On Wed, Nov 06, 2019 at 11:38:57AM -0400, Jason Gunthorpe wrote:
> >    959                  rc = qedr_init_user_queue(udata, dev, &cq->q, ureq.addr,
> >    960                                            ureq.len, true,
> >    961                                            IB_ACCESS_LOCAL_WRITE,
> >    962                                            1, 1);
> >    963                  if (rc)
> >    964                          goto err0;
> >    965  
> >    966                  pbl_ptr = cq->q.pbl_tbl->pa;
> >    967                  page_cnt = cq->q.pbl_info.num_pbes;
> >    968  
> >    969			cq->ibcq.cqe = chain_entries;
> >    970			cq->q.db_addr = ctx->dpi_addr + db_offset;
> >                                         ^^^^^^^^^^^^^
> > New unchecked dereference.
> 
> For rdma_udata_to_drv_context(), udata != NULL implies ctx != NULL
> 

In that case, the other check for NULL ctx is inside an if (udata)
condition so it could be removed.

  1036		return 0;
  1037	
  1038	err2:
  1039		destroy_iparams.icid = cq->icid;
  1040		dev->ops->rdma_destroy_cq(dev->rdma_ctx, &destroy_iparams,
  1041					  &destroy_oparams);
  1042	err1:
  1043		if (udata) {
                    ^^^^^
  1044			qedr_free_pbl(dev, &cq->q.pbl_info, cq->q.pbl_tbl);
  1045			ib_umem_release(cq->q.umem);
  1046			if (ctx)
                            ^^^
Too late.

  1047				rdma_user_mmap_entry_remove(&ctx->ibucontext,
  1048							    cq->q.db_mmap_entry);




regards,
dan carpenter



      reply	other threads:[~2019-11-07 11:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-06  7:52 [bug report] RDMA/qedr: Add doorbell overflow recovery support Dan Carpenter
2019-11-06 15:38 ` Jason Gunthorpe
2019-11-07 11:40   ` Dan Carpenter [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=20191107114009.GL21796@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=jgg@ziepe.ca \
    --cc=linux-rdma@vger.kernel.org \
    --cc=michal.kalderon@marvell.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;
as well as URLs for NNTP newsgroup(s).