netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jiri Pirko <jiri@resnulli.us>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, idosch@mellanox.com, eladr@mellanox.com,
	ogerlitz@mellanox.com, Jiri Pirko <jiri@mellanox.com>
Subject: [patch net-next 1/7] mlxsw: Call free_netdev when removing port
Date: Thu,  6 Aug 2015 16:41:52 +0200	[thread overview]
Message-ID: <1438872118-16869-2-git-send-email-jiri@resnulli.us> (raw)
In-Reply-To: <1438872118-16869-1-git-send-email-jiri@resnulli.us>

From: Ido Schimmel <idosch@mellanox.com>

When removing a port's netdevice we should also free the memory
allocated by alloc_etherdev(). Do this by calling free_netdev() at the
end of the teardown sequence.

Reported-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@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 29b46ee..687f5cb 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/switchx2.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/switchx2.c
@@ -1079,6 +1079,7 @@ static void mlxsw_sx_port_remove(struct mlxsw_sx *mlxsw_sx, u8 local_port)
 	unregister_netdev(mlxsw_sx_port->dev); /* This calls ndo_stop */
 	mlxsw_sx_port_swid_set(mlxsw_sx_port, MLXSW_PORT_SWID_DISABLED_PORT);
 	free_percpu(mlxsw_sx_port->pcpu_stats);
+	free_netdev(mlxsw_sx_port->dev);
 }
 
 static void mlxsw_sx_ports_remove(struct mlxsw_sx *mlxsw_sx)
-- 
1.9.3

  reply	other threads:[~2015-08-06 14:42 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-06 14:41 [patch net-next 0/7] mlxsw: Couple of fixes/adjustments Jiri Pirko
2015-08-06 14:41 ` Jiri Pirko [this message]
2015-08-06 14:41 ` [patch net-next 2/7] mlxsw: Make system port to local port mapping explicit Jiri Pirko
2015-08-06 14:41 ` [patch net-next 3/7] mlxsw: Make pci module dependent on HAS_DMA and HAS_IOMEM Jiri Pirko
2015-08-06 14:41 ` [patch net-next 4/7] mlxsw: Strip FCS from incoming packets Jiri Pirko
2015-08-06 14:41 ` [patch net-next 5/7] mlxsw: Simplify mlxsw_sx_port_xmit function Jiri Pirko
2015-08-06 14:41 ` [patch net-next 6/7] mlxsw: Use correct skb length when dumping payload Jiri Pirko
2015-08-06 14:41 ` [patch net-next 7/7] mlxsw: Fix use-after-free bug in mlxsw_sx_port_xmit Jiri Pirko
2015-08-10  5:54 ` [patch net-next 0/7] mlxsw: Couple of fixes/adjustments 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=1438872118-16869-2-git-send-email-jiri@resnulli.us \
    --to=jiri@resnulli.us \
    --cc=davem@davemloft.net \
    --cc=eladr@mellanox.com \
    --cc=idosch@mellanox.com \
    --cc=jiri@mellanox.com \
    --cc=netdev@vger.kernel.org \
    --cc=ogerlitz@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).