Linux kernel -stable discussions
 help / color / mirror / Atom feed
* Patch "IB/mlx4: Fix memory leak if QP creation failed" has been added to the 4.4-stable tree
@ 2016-08-18 12:44 gregkh
  0 siblings, 0 replies; only message in thread
From: gregkh @ 2016-08-18 12:44 UTC (permalink / raw)
  To: dotanb, dledford, gregkh, jackm, leon; +Cc: stable, stable-commits


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 <stable@vger.kernel.org> know about it.


>From 5b420d9cf7382c6e1512e96e02d18842d272049c Mon Sep 17 00:00:00 2001
From: Dotan Barak <dotanb@dev.mellanox.co.il>
Date: Wed, 22 Jun 2016 17:27:31 +0300
Subject: IB/mlx4: Fix memory leak if QP creation failed

From: Dotan Barak <dotanb@dev.mellanox.co.il>

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")
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>

---
 drivers/infiniband/hw/mlx4/qp.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--- a/drivers/infiniband/hw/mlx4/qp.c
+++ b/drivers/infiniband/hw/mlx4/qp.c
@@ -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 dotanb@dev.mellanox.co.il are

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-08-18 12:44 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-18 12:44 Patch "IB/mlx4: Fix memory leak if QP creation failed" has been added to the 4.4-stable tree gregkh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox