summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVitaly Kuznetsov <vkuznets@redhat.com>2017-05-11 14:58:06 +0300
committerBen Hutchings <ben@decadent.org.uk>2018-11-20 21:05:22 +0300
commitfefbe65bf51451aaa4f547d2f38303379523d51f (patch)
tree22407be73f1ba5d6e3b0f5d633f2e72221ddad16
parentc14f2074fd091db7d95e912bff17efd595c569fe (diff)
downloadlinux-fefbe65bf51451aaa4f547d2f38303379523d51f.tar.xz
xen-netfront: avoid crashing on resume after a failure in talk_to_netback()
commit d86b5672b1adb98b4cdd6fbf0224bbfb03db6e2e upstream. Unavoidable crashes in netfront_resume() and netback_changed() after a previous fail in talk_to_netback() (e.g. when we fail to read MAC from xenstore) were discovered. The failure path in talk_to_netback() does unregister/free for netdev but we don't reset drvdata and we try accessing it after resume. Fix the bug by removing the whole xen device completely with device_unregister(), this guarantees we won't have any calls into netfront after a failure. Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
-rw-r--r--drivers/net/xen-netfront.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
index 5e77cc03e8a6..eba6c55a08e3 100644
--- a/drivers/net/xen-netfront.c
+++ b/drivers/net/xen-netfront.c
@@ -1980,8 +1980,7 @@ abort_transaction_no_dev_fatal:
xennet_disconnect_backend(info);
xennet_destroy_queues(info);
out:
- unregister_netdev(info->netdev);
- xennet_free_netdev(info->netdev);
+ device_unregister(&dev->dev);
return err;
}