Re: [PATCH for-next 2/2] RDMA/bnxt_re: Protect the PD table bitmap

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Aug 18, 2023 at 9:50 PM Jason Gunthorpe <jgg@xxxxxxxxxx> wrote:
>
> On Mon, Aug 14, 2023 at 10:00:19AM -0700, Selvin Xavier wrote:
> > Syncrhonization is required to avoid simultaneous allocation
> > of the PD. Add a new mutex lock to handle allocation from
> > the PD table.
> >
> > Signed-off-by: Kashyap Desai <kashyap.desai@xxxxxxxxxxxx>
> > Signed-off-by: Selvin Xavier <selvin.xavier@xxxxxxxxxxxx>
> > ---
> >  drivers/infiniband/hw/bnxt_re/ib_verbs.c  |  2 +-
> >  drivers/infiniband/hw/bnxt_re/qplib_res.c | 26 ++++++++++++++++++++------
> >  drivers/infiniband/hw/bnxt_re/qplib_res.h |  4 +++-
> >  3 files changed, 24 insertions(+), 8 deletions(-)
>
> This needs a fixes line, it seems like a serious bug??
Yes. It is a critical fix. Will add fixes line and post a v2.
>
> > diff --git a/drivers/infiniband/hw/bnxt_re/qplib_res.c b/drivers/infiniband/hw/bnxt_re/qplib_res.c
> > index 6f1e8b7..79c43c2 100644
> > --- a/drivers/infiniband/hw/bnxt_re/qplib_res.c
> > +++ b/drivers/infiniband/hw/bnxt_re/qplib_res.c
> > @@ -642,31 +642,44 @@ static void bnxt_qplib_init_sgid_tbl(struct bnxt_qplib_sgid_tbl *sgid_tbl,
> >  }
> >
> >  /* PDs */
> > -int bnxt_qplib_alloc_pd(struct bnxt_qplib_pd_tbl *pdt, struct bnxt_qplib_pd *pd)
> > +int bnxt_qplib_alloc_pd(struct bnxt_qplib_res  *res, struct bnxt_qplib_pd *pd)
> >  {
> > +     struct bnxt_qplib_pd_tbl *pdt = &res->pd_tbl;
> >       u32 bit_num;
> > +     int rc = 0;
> >
> > +     mutex_lock(&res->pd_tbl_lock);
> >       bit_num = find_first_bit(pdt->tbl, pdt->max);
>
> Please make a followup patch to change this into an IDA unless the pd
> max is really small. Don't opencode IDAs in drivers..
pd max is 64k. We will create a followup patch . Thanks.
>
> Jason

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature


[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux