From: Jiri Pirko <jiri@resnulli.us>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, arkadis@mellanox.com, eladr@mellanox.com,
yotamg@mellanox.com, nogahf@mellanox.com, idosch@mellanox.com
Subject: [patch net 2/3] mlxsw: switchx2: Fix memory leak at skb reallocation
Date: Thu, 12 Jan 2017 09:10:38 +0100 [thread overview]
Message-ID: <1484208639-1890-3-git-send-email-jiri@resnulli.us> (raw)
In-Reply-To: <1484208639-1890-1-git-send-email-jiri@resnulli.us>
From: Arkadi Sharshevsky <arkadis@mellanox.com>
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>
---
drivers/net/ethernet/mellanox/mlxsw/switchx2.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/ethernet/mellanox/mlxsw/switchx2.c b/drivers/net/ethernet/mellanox/mlxsw/switchx2.c
index 150ccf5..2e88115e 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/switchx2.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/switchx2.c
@@ -345,6 +345,7 @@ static netdev_tx_t mlxsw_sx_port_xmit(struct sk_buff *skb,
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
--
2.7.4
next prev parent reply other threads:[~2017-01-12 8:10 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-12 8:10 [patch net 0/3] mlxsw: Couple of fixes Jiri Pirko
2017-01-12 8:10 ` [patch net 1/3] mlxsw: spectrum: Fix memory leak at skb reallocation Jiri Pirko
2017-01-12 8:10 ` Jiri Pirko [this message]
2017-01-12 8:10 ` [patch net 3/3] mlxsw: pci: Fix EQE structure definition Jiri Pirko
2017-01-12 14:26 ` [patch net 0/3] mlxsw: Couple of fixes David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1484208639-1890-3-git-send-email-jiri@resnulli.us \
--to=jiri@resnulli.us \
--cc=arkadis@mellanox.com \
--cc=davem@davemloft.net \
--cc=eladr@mellanox.com \
--cc=idosch@mellanox.com \
--cc=netdev@vger.kernel.org \
--cc=nogahf@mellanox.com \
--cc=yotamg@mellanox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).