All of lore.kernel.org
 help / color / mirror / Atom feed
* Patch "mlxsw: switchx2: Fix memory leak at skb reallocation" has been added to the 4.9-stable tree
@ 2017-02-01  8:11 gregkh
  0 siblings, 0 replies; only message in thread
From: gregkh @ 2017-02-01  8:11 UTC (permalink / raw)
  To: arkadis, davem, gregkh, jiri; +Cc: stable, stable-commits


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

    mlxsw: switchx2: Fix memory leak at skb reallocation

to the 4.9-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:
     mlxsw-switchx2-fix-memory-leak-at-skb-reallocation.patch
and it can be found in the queue-4.9 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 foo@baz Wed Feb  1 08:50:24 CET 2017
From: Arkadi Sharshevsky <arkadis@mellanox.com>
Date: Thu, 12 Jan 2017 09:10:38 +0100
Subject: mlxsw: switchx2: Fix memory leak at skb reallocation

From: Arkadi Sharshevsky <arkadis@mellanox.com>


[ Upstream commit 400fc0106dd8c27ed84781c929c1a184785b9c79 ]

During transmission the skb is checked for headroom in order to
add vendor specific header. In case the skb needs to be re-allocated,
skb_realloc_headroom() is called to make a private copy of the original,
but doesn't release it. Current code assumes that the original skb is
released during reallocation and only releases it at the error path
which causes a memory leak.

Fix this by adding the original skb release to the main path.

Fixes: d003462a50de ("mlxsw: Simplify mlxsw_sx_port_xmit function")
Signed-off-by: Arkadi Sharshevsky <arkadis@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/net/ethernet/mellanox/mlxsw/switchx2.c |    1 +
 1 file changed, 1 insertion(+)

--- a/drivers/net/ethernet/mellanox/mlxsw/switchx2.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/switchx2.c
@@ -314,6 +314,7 @@ static netdev_tx_t mlxsw_sx_port_xmit(st
 			dev_kfree_skb_any(skb_orig);
 			return NETDEV_TX_OK;
 		}
+		dev_consume_skb_any(skb_orig);
 	}
 	mlxsw_sx_txhdr_construct(skb, &tx_info);
 	/* TX header is consumed by HW on the way so we shouldn't count its


Patches currently in stable-queue which might be from arkadis@mellanox.com are

queue-4.9/mlxsw-spectrum-fix-memory-leak-at-skb-reallocation.patch
queue-4.9/mlxsw-switchx2-fix-memory-leak-at-skb-reallocation.patch

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

only message in thread, other threads:[~2017-02-01  8:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-01  8:11 Patch "mlxsw: switchx2: Fix memory leak at skb reallocation" has been added to the 4.9-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.