All of lore.kernel.org
 help / color / mirror / Atom feed
* Patch "IB/core: Fix possible memory leak in cma_resolve_iboe_route()" has been added to the 4.7-stable tree
@ 2016-10-05 13:20 gregkh
  0 siblings, 0 replies; only message in thread
From: gregkh @ 2016-10-05 13:20 UTC (permalink / raw)
  To: weiyj.lk, dledford, gregkh, haggaie; +Cc: stable, stable-commits


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

    IB/core: Fix possible memory leak in cma_resolve_iboe_route()

to the 4.7-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-core-fix-possible-memory-leak-in-cma_resolve_iboe_route.patch
and it can be found in the queue-4.7 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 23d70503ee187819a3775c7ac73f17c5bfe3fad0 Mon Sep 17 00:00:00 2001
From: Wei Yongjun <weiyj.lk@gmail.com>
Date: Fri, 5 Aug 2016 13:46:49 +0000
Subject: IB/core: Fix possible memory leak in cma_resolve_iboe_route()

From: Wei Yongjun <weiyj.lk@gmail.com>

commit 23d70503ee187819a3775c7ac73f17c5bfe3fad0 upstream.

'work' and 'route->path_rec' are malloced in cma_resolve_iboe_route()
and should be freed before leaving from the error handling cases,
otherwise it will cause memory leak.

Fixes: 200298326b27 ('IB/core: Validate route when we init ah')
Signed-off-by: Wei Yongjun <weiyj.lk@gmail.com>
Reviewed-by: Haggai Eran <haggaie@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/infiniband/core/cma.c |   18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

--- a/drivers/infiniband/core/cma.c
+++ b/drivers/infiniband/core/cma.c
@@ -2452,18 +2452,24 @@ static int cma_resolve_iboe_route(struct
 
 	if (addr->dev_addr.bound_dev_if) {
 		ndev = dev_get_by_index(&init_net, addr->dev_addr.bound_dev_if);
-		if (!ndev)
-			return -ENODEV;
+		if (!ndev) {
+			ret = -ENODEV;
+			goto err2;
+		}
 
 		if (ndev->flags & IFF_LOOPBACK) {
 			dev_put(ndev);
-			if (!id_priv->id.device->get_netdev)
-				return -EOPNOTSUPP;
+			if (!id_priv->id.device->get_netdev) {
+				ret = -EOPNOTSUPP;
+				goto err2;
+			}
 
 			ndev = id_priv->id.device->get_netdev(id_priv->id.device,
 							      id_priv->id.port_num);
-			if (!ndev)
-				return -ENODEV;
+			if (!ndev) {
+				ret = -ENODEV;
+				goto err2;
+			}
 		}
 
 		route->path_rec->net = &init_net;


Patches currently in stable-queue which might be from weiyj.lk@gmail.com are

queue-4.7/asoc-intel-skylake-fix-error-return-code-in-skl_probe.patch
queue-4.7/ib-core-fix-possible-memory-leak-in-cma_resolve_iboe_route.patch

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

only message in thread, other threads:[~2016-10-05 13:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-05 13:20 Patch "IB/core: Fix possible memory leak in cma_resolve_iboe_route()" has been added to the 4.7-stable tree gregkh

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.