]> asedeno.scripts.mit.edu Git - linux.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)
committerDavid S. Miller <davem@davemloft.net>
Thu, 22 Mar 2018 15:52:30 +0000 (11:52 -0400)
commit6be687395b3124f002a653c1a50b3260222b3cd7
treebf6745b4a0e6676f097e26200685e0670b38f089
parent3d21ac6fe92d8dc1040c2d8f4f0a70cab9728f06
s390/qeth: free netdevice when removing a card

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>
drivers/s390/net/qeth_core_main.c
drivers/s390/net/qeth_l2_main.c
drivers/s390/net/qeth_l3_main.c