Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1572618

[PATCH 4.4 02/20] mlxsw: spectrum: Fix memory leak at skb reallocation

From Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Newsgroups linux.kernel
Subject [PATCH 4.4 02/20] mlxsw: spectrum: Fix memory leak at skb reallocation
Date 2017-02-02 19:40 +0100
Message-ID <t6usB-7Bs-89@gated-at.bofh.it> (permalink)
References <t6usy-7Bs-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


4.4-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Arkadi Sharshevsky <arkadis@mellanox.com>


[ Upstream commit 36bf38d158d3482119b3e159c0619b3c1539b508 ]

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: 56ade8fe3fe1 ("mlxsw: spectrum: Add initial support for Spectrum ASIC")
Signed-off-by: Arkadi Sharshevsky <arkadis@mellanox.com>
Reviewed-by: Ido Schimmel <idosch@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/spectrum.c |    1 +
 1 file changed, 1 insertion(+)

--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
@@ -390,6 +390,7 @@ static netdev_tx_t mlxsw_sp_port_xmit(st
 			dev_kfree_skb_any(skb_orig);
 			return NETDEV_TX_OK;
 		}
+		dev_consume_skb_any(skb_orig);
 	}
 
 	if (eth_skb_pad(skb)) {

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 4.4 00/20] 4.4.47-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-02-02 19:40 +0100
  [PATCH 4.4 15/20] tcp: initialize max window for a new fastopen socket Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-02-02 19:40 +0100
  [PATCH 4.4 12/20] net: fix harmonize_features() vs NETIF_F_HIGHDMA Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-02-02 19:40 +0100
  [PATCH 4.4 02/20] mlxsw: spectrum: Fix memory leak at skb reallocation Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-02-02 19:40 +0100
  [PATCH 4.4 20/20] net: dsa: Bring back device detaching in dsa_slave_suspend() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-02-02 19:40 +0100
  [PATCH 4.4 05/20] net: lwtunnel: Handle lwtunnel_fill_encap failure Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-02-02 19:40 +0100
  [PATCH 4.4 14/20] ipv6: addrconf: Avoid addrconf_disable_change() using RCU read-side lock Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-02-02 19:40 +0100
  [PATCH 4.4 13/20] net: phy: bcm63xx: Utilize correct config_intr function Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-02-02 19:40 +0100
  [PATCH 4.4 06/20] net: ipv4: fix table id in getroute response Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-02-02 19:40 +0100
  Re: [PATCH 4.4 00/20] 4.4.47-stable review Shuah Khan <shuahkh@osg.samsung.com> - 2017-02-02 21:40 +0100
  Re: [PATCH 4.4 00/20] 4.4.47-stable review Guenter Roeck <linux@roeck-us.net> - 2017-02-03 06:20 +0100

csiph-web