Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4dc54442 authored by Colin Ian King's avatar Colin Ian King Committed by Doug Ledford
Browse files

RDMA/ocrdma: fix double free on pd



A reorganisation of the PD allocation and deallocation in commit
9ba1377d ("RDMA/ocrdma: Move PD resource management to driver.")
introduced a double free on pd, as detected by static analysis by
smatch:

drivers/infiniband/hw/ocrdma/ocrdma_verbs.c:682 ocrdma_alloc_pd()
  error: double free of 'pd'^

The original call to ocrdma_mbx_dealloc_pd() (which does not kfree
pd) was replaced with a call to _ocrdma_dealloc_pd() (which does
kfree pd).  The kfree following this call causes the double free,
so just remove it to fix the problem.

Fixes: 9ba1377d ("RDMA/ocrdma: Move PD resource management to driver.")
Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
Acked-By: default avatarDevesh Sharma <devesh.sharma@avagotech.com>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent fc3aa45b
Loading
Loading
Loading
Loading
+0 −1
Original line number Original line Diff line number Diff line
@@ -684,7 +684,6 @@ struct ib_pd *ocrdma_alloc_pd(struct ib_device *ibdev,
		ocrdma_release_ucontext_pd(uctx);
		ocrdma_release_ucontext_pd(uctx);
	} else {
	} else {
		status = _ocrdma_dealloc_pd(dev, pd);
		status = _ocrdma_dealloc_pd(dev, pd);
		kfree(pd);
	}
	}
exit:
exit:
	return ERR_PTR(status);
	return ERR_PTR(status);