Re: [PATCH] xen/pvcalls-back: test for errors when calling backend_connect()
From: Stefano Stabellini
Date: Mon May 11 2020 - 17:41:53 EST
On Mon, 11 May 2020, Juergen Gross wrote:
> backend_connect() can fail, so switch the device to connected only if
> no error occurred.
>
> Fixes: 0a9c75c2c7258f2 ("xen/pvcalls: xenbus state handling")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
Reviewed-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>
> ---
> drivers/xen/pvcalls-back.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/xen/pvcalls-back.c b/drivers/xen/pvcalls-back.c
> index cf4ce3e9358d..41a18ece029a 100644
> --- a/drivers/xen/pvcalls-back.c
> +++ b/drivers/xen/pvcalls-back.c
> @@ -1088,7 +1088,8 @@ static void set_backend_state(struct xenbus_device *dev,
> case XenbusStateInitialised:
> switch (state) {
> case XenbusStateConnected:
> - backend_connect(dev);
> + if (backend_connect(dev))
> + return;
Do you think it would make sense to WARN?
> xenbus_switch_state(dev, XenbusStateConnected);
> break;
> case XenbusStateClosing:
> --
> 2.26.1
>