]> git.karo-electronics.de Git - linux-beck.git/commit
mlxsw: spectrum: Fix memory leak at skb reallocation
authorArkadi Sharshevsky <arkadis@mellanox.com>
Thu, 12 Jan 2017 08:10:37 +0000 (09:10 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 4 Feb 2017 08:47:08 +0000 (09:47 +0100)
commit7c249f3306b6f42f7a0a9d9cbd0455035f8a067c
tree064a79a67d266c5fbb91fb725e8b975a3cc4dbb9
parent5b3df4401064ef94cddac976aba1474a7050fa5e
mlxsw: spectrum: Fix memory leak at skb reallocation

[ 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