diff mbox series

[v2] vhost-user: delete net client if necessary

Message ID 20180612022445.5192-1-linzhecheng@huawei.com
State New
Headers show
Series [v2] vhost-user: delete net client if necessary | expand

Commit Message

linzhecheng June 12, 2018, 2:24 a.m. UTC
As qemu_new_net_client create new ncs but error happens later,
ncs will be left in global net_clients list and we can't use them any
more, so we need to cleanup them.

Signed-off-by: linzhecheng <linzhecheng@huawei.com>

Comments

Jason Wang June 15, 2018, 2:35 a.m. UTC | #1
On 2018年06月12日 10:24, linzhecheng wrote:
> As qemu_new_net_client create new ncs but error happens later,
> ncs will be left in global net_clients list and we can't use them any
> more, so we need to cleanup them.
>
> Signed-off-by: linzhecheng <linzhecheng@huawei.com>
>
> diff --git a/net/vhost-user.c b/net/vhost-user.c
> index 608b837175..a39f9c9974 100644
> --- a/net/vhost-user.c
> +++ b/net/vhost-user.c
> @@ -345,6 +345,9 @@ err:
>               s->vhost_user = NULL;
>           }
>       }
> +    if (nc0) {
> +        qemu_del_net_client(nc0);
> +    }
>   
>       return -1;
>   }

Applied and queued for -stable.

Please cc stable next time.

Btw, do we have similar issues for tap?

Thanks
diff mbox series

Patch

diff --git a/net/vhost-user.c b/net/vhost-user.c
index 608b837175..a39f9c9974 100644
--- a/net/vhost-user.c
+++ b/net/vhost-user.c
@@ -345,6 +345,9 @@  err:
             s->vhost_user = NULL;
         }
     }
+    if (nc0) {
+        qemu_del_net_client(nc0);
+    }
 
     return -1;
 }