]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
s390/qeth: free netdevice when removing a card
authorJulian Wiedmann <jwi@linux.vnet.ibm.com>
Tue, 20 Mar 2018 06:59:12 +0000 (07:59 +0100)
committerThadeu Lima de Souza Cascardo <cascardo@canonical.com>
Mon, 2 Apr 2018 10:19:50 +0000 (07:19 -0300)
commitcf1c9423d3b5e0b3abdfa62262236f36107c9bf9
treea299faef980b7baa8b0eaf239796fb82343cfaac
parent4c9ee5ecec90dde063f63ffc02b94f9aa9aa12ec
s390/qeth: free netdevice when removing a card

BugLink: http://bugs.launchpad.net/bugs/1760585
[ Upstream commit 6be687395b3124f002a653c1a50b3260222b3cd7 ]

On removal, a qeth card's netdevice is currently not properly freed
because the call chain looks as follows:

qeth_core_remove_device(card)
lx_remove_device(card)
unregister_netdev(card->dev)
card->dev = NULL !!!
qeth_core_free_card(card)
if (card->dev) !!!
free_netdev(card->dev)

Fix it by free'ing the netdev straight after unregistering. This also
fixes the sysfs-driven layer switch case (qeth_dev_layer2_store()),
where the need to free the current netdevice was not considered at all.

Note that free_netdev() takes care of the netif_napi_del() for us too.

Fixes: 4a71df50047f ("qeth: new qeth device driver")
Signed-off-by: Julian Wiedmann <jwi@linux.vnet.ibm.com>
Reviewed-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
drivers/s390/net/qeth_core_main.c
drivers/s390/net/qeth_l2_main.c
drivers/s390/net/qeth_l3_main.c