Skip to contentSkip to conversation

Patch "IB/mlx4: Fix memory leak if QP creation failed" has been added to the 4.4-stable tree

PATCH [email protected] 1 participant 1 message Aug 18, 2016

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

IB/mlx4: Fix memory leak if QP creation failed

to the 4.4-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
ib-mlx4-fix-memory-leak-if-qp-creation-failed.patch
and it can be found in the queue-4.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From 5b420d9cf7382c6e1512e96e02d18842d272049c Mon Sep 17 00:00:00 2001

From: Dotan Barak <[email protected]>
Date: Wed, 22 Jun 2016 17:27:31 +0300
Subject: IB/mlx4: Fix memory leak if QP creation failed

From: Dotan Barak <[email protected]>

commit 5b420d9cf7382c6e1512e96e02d18842d272049c upstream.

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 1ffeb2eb8be99 ("IB/mlx4: SR-IOV IB context objects and proxy/tunnel SQP support")
---
 drivers/infiniband/hw/mlx4/qp.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/infiniband/hw/mlx4/qp.c +3 -1
@@ -1162,8 +1162,10 @@ struct ib_qp *mlx4_ib_create_qp(struct i
 	{
 		err = create_qp_common(to_mdev(pd->device), pd, init_attr,
 				       udata, 0, &qp, gfp);
-		if (err)
+		if (err) {
+			kfree(qp);
 			return ERR_PTR(err);
+		}
 
 		qp->ibqp.qp_num = qp->mqp.qpn;
 		qp->xrcdn = xrcdn;

Patches currently in stable-queue which might be from [email protected] are

queue-4.4/ib-mlx4-fix-memory-leak-if-qp-creation-failed.patch