xen-netfront: avoid crashing on resume after a failure in talk_to_netback()
Subsystems (3)
PATCH v2 1/1 xen-netfront: avoid crashing on resume after a failure in talk_to_netback()
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.
---
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(-)
drivers/net/xen-netfront.c +1 -2
@@ -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; }
Signature · 1 line
2.9.3
David Miller
maintainerFrom: Vitaly Kuznetsov <[email protected]>
Date: Thu, 11 May 2017 13:58:06 +0200
Quoted 10 lines
Unavoidable crashes in
netfront_resume()andnetback_changed()after a previous fail intalk_to_netback()(e.g. when we fail to read MAC from xenstore) were discovered. The failure path intalk_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.
Quoted 5 lines
Signed-off-by Vitaly Kuznetsov <[email protected]>---
Changes since v1: instead of cleaning drvdata and checking for it innetfront_resume()andnetback_changed()remove the device completely withdevice_unregister()[David Miller]
This looks a lot better, applied, thanks!
David Miller
maintainerFrom: Vitaly Kuznetsov <[email protected]>
Date: Thu, 11 May 2017 13:58:06 +0200
Quoted 10 lines
Unavoidable crashes in
netfront_resume()andnetback_changed()after a previous fail intalk_to_netback()(e.g. when we fail to read MAC from xenstore) were discovered. The failure path intalk_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.
Quoted 5 lines
Signed-off-by Vitaly Kuznetsov <[email protected]>---
Changes since v1: instead of cleaning drvdata and checking for it innetfront_resume()andnetback_changed()remove the device completely withdevice_unregister()[David Miller]
This looks a lot better, applied, thanks!
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel