Re: [PATCH -next] IB/qib: Add missing err handle for qib_user_sdma_rb_insert

From: Jason Gunthorpe
Date: Fri Jan 04 2019 - 17:38:09 EST


On Fri, Jan 04, 2019 at 06:39:50PM +0000, Marciniszyn, Mike wrote:
> > diff --git a/drivers/infiniband/hw/qib/qib_user_sdma.c
> > b/drivers/infiniband/hw/qib/qib_user_sdma.c
> > index 31c523b..e87c0a7 100644
> > +++ b/drivers/infiniband/hw/qib/qib_user_sdma.c
> > @@ -237,6 +237,8 @@ qib_user_sdma_queue_create(struct device *dev,
> > int unit, int ctxt, int sctxt)
> >
> > ret = qib_user_sdma_rb_insert(&qib_user_sdma_rb_root,
> > sdma_rb_node);
> > + if (ret == 0)
> > + goto err_rb;
> > }
> > pq->sdma_rb_node = sdma_rb_node;
> >
>
> Thanks!
>
> This patch is ok.

> The NULL returned from this routine will result in an error return up to PSM which will fail.
>
> The bail branch will do the necessary cleanup, including freeing the
> node that couldn't be added.

How? sdma_rb_node is a stack variable that is not accessed during
cleanup?

Jason