mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 18:09:56 +00:00
IB/mlx4: Fix memory leak if QP creation failed
commit5b420d9cf7upstream. When RC, UC, or RAW QPs are created, a qp object is allocated (kzalloc). If at a later point (in procedure create_qp_common) the qp creation fails, this qp object must be freed. Fixes:1ffeb2eb8b("IB/mlx4: SR-IOV IB context objects and proxy/tunnel SQP support") Signed-off-by: Dotan Barak <dotanb@dev.mellanox.co.il> Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il> Signed-off-by: Leon Romanovsky <leon@kernel.org> Signed-off-by: Doug Ledford <dledford@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
@@ -1162,8 +1162,10 @@ struct ib_qp *mlx4_ib_create_qp(struct ib_pd *pd,
|
|||||||
{
|
{
|
||||||
err = create_qp_common(to_mdev(pd->device), pd, init_attr,
|
err = create_qp_common(to_mdev(pd->device), pd, init_attr,
|
||||||
udata, 0, &qp, gfp);
|
udata, 0, &qp, gfp);
|
||||||
if (err)
|
if (err) {
|
||||||
|
kfree(qp);
|
||||||
return ERR_PTR(err);
|
return ERR_PTR(err);
|
||||||
|
}
|
||||||
|
|
||||||
qp->ibqp.qp_num = qp->mqp.qpn;
|
qp->ibqp.qp_num = qp->mqp.qpn;
|
||||||
qp->xrcdn = xrcdn;
|
qp->xrcdn = xrcdn;
|
||||||
|
|||||||
Reference in New Issue
Block a user