* [PATCH v2] xen-netfront: avoid crashing on resume after a failure in talk_to_netback()
@ 2017-05-11 11:58 Vitaly Kuznetsov
2017-05-12 1:39 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Vitaly Kuznetsov @ 2017-05-11 11:58 UTC (permalink / raw)
To: xen-devel
Cc: netdev, linux-kernel, Boris Ostrovsky, Juergen Gross, David Miller
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>
---
Changes since v1: instead of cleaning drvdata and checking for it in
netfront_resume() and netback_changed() remove the device completely with
device_unregister() [David Miller]
---
drivers/net/xen-netfront.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
index 6ffc482..7b61adb 100644
--- a/drivers/net/xen-netfront.c
+++ b/drivers/net/xen-netfront.c
@@ -1934,8 +1934,7 @@ static int talk_to_netback(struct xenbus_device *dev,
xennet_disconnect_backend(info);
xennet_destroy_queues(info);
out:
- unregister_netdev(info->netdev);
- xennet_free_netdev(info->netdev);
+ device_unregister(&dev->dev);
return err;
}
--
2.9.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] xen-netfront: avoid crashing on resume after a failure in talk_to_netback()
2017-05-11 11:58 [PATCH v2] xen-netfront: avoid crashing on resume after a failure in talk_to_netback() Vitaly Kuznetsov
@ 2017-05-12 1:39 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2017-05-12 1:39 UTC (permalink / raw)
To: vkuznets; +Cc: xen-devel, netdev, linux-kernel, boris.ostrovsky, jgross
From: Vitaly Kuznetsov <vkuznets@redhat.com>
Date: Thu, 11 May 2017 13:58:06 +0200
> 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>
> ---
> Changes since v1: instead of cleaning drvdata and checking for it in
> netfront_resume() and netback_changed() remove the device completely with
> device_unregister() [David Miller]
This looks a lot better, applied, thanks!
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-05-12 1:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-11 11:58 [PATCH v2] xen-netfront: avoid crashing on resume after a failure in talk_to_netback() Vitaly Kuznetsov
2017-05-12 1:39 ` David Miller
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).