patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH] vhost: fix crash on reconnect
@ 2021-07-26  7:58 Maxime Coquelin
  2021-07-26  8:13 ` Wang, Yinan
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Maxime Coquelin @ 2021-07-26  7:58 UTC (permalink / raw)
  To: dev, chenbo.xia, yinan.wang, weix.ling; +Cc: Maxime Coquelin, stable

When the vhost-user frontend like Virtio-user tries to
reconnect to the restarted Vhost backend, the Vhost backend
segfaults when multiqueue is enabled.

This is caused by VHOST_USER_GET_VRING_BASE being called for
a virtqueue that has not been created before, causing a NULL
pointer dereferencing.

This patch adds the VHOST_USER_GET_VRING_BASE requests to
the list of requests that trigger queue pair allocations.

Fixes: 160cbc815b41 ("vhost: remove a hack on queue allocation")
Cc: stable@dpdk.org

Reported-by: Yinan Wang <yinan.wang@intel.com>
Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---
 lib/vhost/vhost_user.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c
index 433f412fa8..29a4c9af60 100644
--- a/lib/vhost/vhost_user.c
+++ b/lib/vhost/vhost_user.c
@@ -2796,6 +2796,7 @@ vhost_user_check_and_alloc_queue_pair(struct virtio_net *dev,
 		break;
 	case VHOST_USER_SET_VRING_NUM:
 	case VHOST_USER_SET_VRING_BASE:
+	case VHOST_USER_GET_VRING_BASE:
 	case VHOST_USER_SET_VRING_ENABLE:
 		vring_idx = msg->payload.state.index;
 		break;
-- 
2.31.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-stable] [PATCH] vhost: fix crash on reconnect
  2021-07-26  7:58 [dpdk-stable] [PATCH] vhost: fix crash on reconnect Maxime Coquelin
@ 2021-07-26  8:13 ` Wang, Yinan
  2021-07-27  1:58 ` Xia, Chenbo
  2021-07-28  6:51 ` Xia, Chenbo
  2 siblings, 0 replies; 4+ messages in thread
From: Wang, Yinan @ 2021-07-26  8:13 UTC (permalink / raw)
  To: Maxime Coquelin, dev, Xia, Chenbo, Ling, WeiX; +Cc: stable

Tested-by: Yinan Wang <yinan.wang@intel.com>


> -----Original Message-----
> From: Maxime Coquelin <maxime.coquelin@redhat.com>
> Sent: 2021?7?26? 15:58
> To: dev@dpdk.org; Xia, Chenbo <chenbo.xia@intel.com>; Wang, Yinan
> <yinan.wang@intel.com>; Ling, WeiX <weix.ling@intel.com>
> Cc: Maxime Coquelin <maxime.coquelin@redhat.com>; stable@dpdk.org
> Subject: [PATCH] vhost: fix crash on reconnect
> 
> When the vhost-user frontend like Virtio-user tries to
> reconnect to the restarted Vhost backend, the Vhost backend
> segfaults when multiqueue is enabled.
> 
> This is caused by VHOST_USER_GET_VRING_BASE being called for
> a virtqueue that has not been created before, causing a NULL
> pointer dereferencing.
> 
> This patch adds the VHOST_USER_GET_VRING_BASE requests to
> the list of requests that trigger queue pair allocations.
> 
> Fixes: 160cbc815b41 ("vhost: remove a hack on queue allocation")
> Cc: stable@dpdk.org
> 
> Reported-by: Yinan Wang <yinan.wang@intel.com>
> Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> ---
>  lib/vhost/vhost_user.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c
> index 433f412fa8..29a4c9af60 100644
> --- a/lib/vhost/vhost_user.c
> +++ b/lib/vhost/vhost_user.c
> @@ -2796,6 +2796,7 @@ vhost_user_check_and_alloc_queue_pair(struct
> virtio_net *dev,
>  		break;
>  	case VHOST_USER_SET_VRING_NUM:
>  	case VHOST_USER_SET_VRING_BASE:
> +	case VHOST_USER_GET_VRING_BASE:
>  	case VHOST_USER_SET_VRING_ENABLE:
>  		vring_idx = msg->payload.state.index;
>  		break;
> --
> 2.31.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-stable] [PATCH] vhost: fix crash on reconnect
  2021-07-26  7:58 [dpdk-stable] [PATCH] vhost: fix crash on reconnect Maxime Coquelin
  2021-07-26  8:13 ` Wang, Yinan
@ 2021-07-27  1:58 ` Xia, Chenbo
  2021-07-28  6:51 ` Xia, Chenbo
  2 siblings, 0 replies; 4+ messages in thread
From: Xia, Chenbo @ 2021-07-27  1:58 UTC (permalink / raw)
  To: Maxime Coquelin, dev, Wang, Yinan, Ling, WeiX; +Cc: stable

> -----Original Message-----
> From: Maxime Coquelin <maxime.coquelin@redhat.com>
> Sent: Monday, July 26, 2021 3:58 PM
> To: dev@dpdk.org; Xia, Chenbo <chenbo.xia@intel.com>; Wang, Yinan
> <yinan.wang@intel.com>; Ling, WeiX <weix.ling@intel.com>
> Cc: Maxime Coquelin <maxime.coquelin@redhat.com>; stable@dpdk.org
> Subject: [PATCH] vhost: fix crash on reconnect
> 
> When the vhost-user frontend like Virtio-user tries to
> reconnect to the restarted Vhost backend, the Vhost backend
> segfaults when multiqueue is enabled.
> 
> This is caused by VHOST_USER_GET_VRING_BASE being called for
> a virtqueue that has not been created before, causing a NULL
> pointer dereferencing.
> 
> This patch adds the VHOST_USER_GET_VRING_BASE requests to
> the list of requests that trigger queue pair allocations.
> 
> Fixes: 160cbc815b41 ("vhost: remove a hack on queue allocation")
> Cc: stable@dpdk.org
> 
> Reported-by: Yinan Wang <yinan.wang@intel.com>
> Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> ---
>  lib/vhost/vhost_user.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c
> index 433f412fa8..29a4c9af60 100644
> --- a/lib/vhost/vhost_user.c
> +++ b/lib/vhost/vhost_user.c
> @@ -2796,6 +2796,7 @@ vhost_user_check_and_alloc_queue_pair(struct virtio_net
> *dev,
>  		break;
>  	case VHOST_USER_SET_VRING_NUM:
>  	case VHOST_USER_SET_VRING_BASE:
> +	case VHOST_USER_GET_VRING_BASE:
>  	case VHOST_USER_SET_VRING_ENABLE:
>  		vring_idx = msg->payload.state.index;
>  		break;
> --
> 2.31.1

Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-stable] [PATCH] vhost: fix crash on reconnect
  2021-07-26  7:58 [dpdk-stable] [PATCH] vhost: fix crash on reconnect Maxime Coquelin
  2021-07-26  8:13 ` Wang, Yinan
  2021-07-27  1:58 ` Xia, Chenbo
@ 2021-07-28  6:51 ` Xia, Chenbo
  2 siblings, 0 replies; 4+ messages in thread
From: Xia, Chenbo @ 2021-07-28  6:51 UTC (permalink / raw)
  To: Maxime Coquelin, dev, Wang, Yinan, Ling, WeiX; +Cc: stable

> -----Original Message-----
> From: Maxime Coquelin <maxime.coquelin@redhat.com>
> Sent: Monday, July 26, 2021 3:58 PM
> To: dev@dpdk.org; Xia, Chenbo <chenbo.xia@intel.com>; Wang, Yinan
> <yinan.wang@intel.com>; Ling, WeiX <weix.ling@intel.com>
> Cc: Maxime Coquelin <maxime.coquelin@redhat.com>; stable@dpdk.org
> Subject: [PATCH] vhost: fix crash on reconnect
> 
> When the vhost-user frontend like Virtio-user tries to
> reconnect to the restarted Vhost backend, the Vhost backend
> segfaults when multiqueue is enabled.
> 
> This is caused by VHOST_USER_GET_VRING_BASE being called for
> a virtqueue that has not been created before, causing a NULL
> pointer dereferencing.
> 
> This patch adds the VHOST_USER_GET_VRING_BASE requests to
> the list of requests that trigger queue pair allocations.
> 
> Fixes: 160cbc815b41 ("vhost: remove a hack on queue allocation")
> Cc: stable@dpdk.org
> 
> Reported-by: Yinan Wang <yinan.wang@intel.com>
> Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> ---
>  lib/vhost/vhost_user.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c
> index 433f412fa8..29a4c9af60 100644
> --- a/lib/vhost/vhost_user.c
> +++ b/lib/vhost/vhost_user.c
> @@ -2796,6 +2796,7 @@ vhost_user_check_and_alloc_queue_pair(struct virtio_net
> *dev,
>  		break;
>  	case VHOST_USER_SET_VRING_NUM:
>  	case VHOST_USER_SET_VRING_BASE:
> +	case VHOST_USER_GET_VRING_BASE:
>  	case VHOST_USER_SET_VRING_ENABLE:
>  		vring_idx = msg->payload.state.index;
>  		break;
> --
> 2.31.1

Applied to next-virtio/main. Thanks!

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-07-28  6:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-26  7:58 [dpdk-stable] [PATCH] vhost: fix crash on reconnect Maxime Coquelin
2021-07-26  8:13 ` Wang, Yinan
2021-07-27  1:58 ` Xia, Chenbo
2021-07-28  6:51 ` Xia, Chenbo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).