]> www.infradead.org Git - users/jedix/linux-maple.git/commit
xen-netback: fix error handling on netback_probe()
authorFilipe Manco <filipe.manco@neclab.eu>
Thu, 15 Sep 2016 15:10:46 +0000 (17:10 +0200)
committerBob Liu <bob.liu@oracle.com>
Thu, 20 Oct 2016 08:05:01 +0000 (04:05 -0400)
commitc5244b7e0ded1165db53a3982c2bca2951b9639f
treefc03e1c998c1eaaf19a87a4c740b0d1711db4b43
parent9a4353e6917cffce40c277395c6ccc00b5483fa2
xen-netback: fix error handling on netback_probe()

In case of error during netback_probe() (e.g. an entry missing on the
xenstore) netback_remove() is called on the new device, which will set
the device backend state to XenbusStateClosed by calling
set_backend_state(). However, the backend state wasn't initialized by
netback_probe() at this point, which will cause and invalid transaction
and set_backend_state() to BUG().

Initialize the backend state at the beginning of netback_probe() to
XenbusStateInitialising, and create two new valid state transitions on
set_backend_state(), from XenbusStateInitialising to XenbusStateClosed,
and from XenbusStateInitialising to XenbusStateInitWait.

Signed-off-by: Filipe Manco <filipe.manco@neclab.eu>
Acked-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit cce94483e47e8e3d74cf4475dea33f9fd4b6ad9f)
Signed-off-by: Bob Liu <bob.liu@oracle.com>
Orabug: 24820937
drivers/net/xen-netback/xenbus.c