]> git.baikalelectronics.ru Git - kernel.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)
committerDavid S. Miller <davem@davemloft.net>
Sat, 17 Sep 2016 13:56:02 +0000 (09:56 -0400)
commitccb977aba8424424210a1a46f24c978262f4d571
tree319883b04cf525b1ab41a6dd6d3f1f5df97443ec
parentb5c6931ddb5e75822cf0d11c55a81fb24c946bc5
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>
drivers/net/xen-netback/xenbus.c