vf->qp_grp_ref_cnt is incorrectly incremented if usnic_uiom_attach_dev_to_pd fails; vf->pd is also erroneously populated in this same failure path.
Signed-off-by: Upinder Malhi <[email protected]> --- drivers/infiniband/hw/usnic/usnic_ib_qp_grp.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/infiniband/hw/usnic/usnic_ib_qp_grp.c b/drivers/infiniband/hw/usnic/usnic_ib_qp_grp.c index e7bec23..06c21be 100644 --- a/drivers/infiniband/hw/usnic/usnic_ib_qp_grp.c +++ b/drivers/infiniband/hw/usnic/usnic_ib_qp_grp.c @@ -395,15 +395,16 @@ static int qp_grp_and_vf_bind(struct usnic_ib_vf *vf, lockdep_assert_held(&vf->lock); pdev = usnic_vnic_get_pdev(vf->vnic); - if (vf->qp_grp_ref_cnt++ == 0) { - vf->pd = pd; + if (vf->qp_grp_ref_cnt == 0) { err = usnic_uiom_attach_dev_to_pd(pd->umem_pd, &pdev->dev); if (err) { usnic_err("Failed to attach %s to domain\n", pci_name(pdev)); return err; } + vf->pd = pd; } + vf->qp_grp_ref_cnt++; WARN_ON(vf->pd != pd); qp_grp->vf = vf; -- 1.8.1 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
