patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH] vhost: fix crash on unregistering in client mode
@ 2018-09-06 13:18 Qiang Zhou
  2018-10-04 21:23 ` Yongseok Koh
  0 siblings, 1 reply; 4+ messages in thread
From: Qiang Zhou @ 2018-09-06 13:18 UTC (permalink / raw)
  To: 525930045; +Cc: Qiang Zhou, stable

when rte_vhost_driver_unregister delete the connection fd,
the fd lock will prevent the vsocket to be freed. But when vhost_user_msg_handler
return error, it will delete vsocket conn_list. And then the fd lock will become
invalid. So the vsocket will be freed in rte_vhost_drivere_unregister and the
vhost_user_read_cb will reconnect.

To fix this:
move delete vsocket conn after reconnect

Cc: stable@dpdk.org

Signed-off-by: Qiang Zhou <zhouqiang2633@gmail.com>
---
 lib/librte_vhost/socket.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/lib/librte_vhost/socket.c b/lib/librte_vhost/socket.c
index d63031747..43da1c51b 100644
--- a/lib/librte_vhost/socket.c
+++ b/lib/librte_vhost/socket.c
@@ -293,16 +293,16 @@ vhost_user_read_cb(int connfd, void *dat, int *remove)
 		if (vsocket->notify_ops->destroy_connection)
 			vsocket->notify_ops->destroy_connection(conn->vid);
 
+		if (vsocket->reconnect) {
+			create_unix_socket(vsocket);
+			vhost_user_start_client(vsocket);
+		}
+
 		pthread_mutex_lock(&vsocket->conn_mutex);
 		TAILQ_REMOVE(&vsocket->conn_list, conn, next);
 		pthread_mutex_unlock(&vsocket->conn_mutex);
 
 		free(conn);
-
-		if (vsocket->reconnect) {
-			create_unix_socket(vsocket);
-			vhost_user_start_client(vsocket);
-		}
 	}
 }
 
-- 
2.14.3 (Apple Git-98)

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

* Re: [dpdk-stable] [PATCH] vhost: fix crash on unregistering in client mode
  2018-09-06 13:18 [dpdk-stable] [PATCH] vhost: fix crash on unregistering in client mode Qiang Zhou
@ 2018-10-04 21:23 ` Yongseok Koh
  0 siblings, 0 replies; 4+ messages in thread
From: Yongseok Koh @ 2018-10-04 21:23 UTC (permalink / raw)
  To: Qiang Zhou; +Cc: 525930045, stable


> On Sep 6, 2018, at 6:18 AM, Qiang Zhou <zhouqiang2633@gmail.com> wrote:
> 
> when rte_vhost_driver_unregister delete the connection fd,
> the fd lock will prevent the vsocket to be freed. But when vhost_user_msg_handler
> return error, it will delete vsocket conn_list. And then the fd lock will become
> invalid. So the vsocket will be freed in rte_vhost_drivere_unregister and the
> vhost_user_read_cb will reconnect.
> 
> To fix this:
> move delete vsocket conn after reconnect

I can't find this patch.
Please use standard "Fixes:" tag. E.g.,

	Fixes: 9c19c83bac54 ("app/testpmd: fix missing jump action in flow action")

> Cc: stable@dpdk.org

Which stable branch are you targeting?
We recommend you to send it with an appropriate prefix. E.g.,

	git send-email --subject-prefix='PATCH 16.11' ...

Please refer to "5.11.1. Backporting patches for Stable Releases"
in the contribution guideline [1]

[1] https://doc.dpdk.org/guides/contributing/patches.html

Thanks,
Yongseok

> Signed-off-by: Qiang Zhou <zhouqiang2633@gmail.com>
> ---
> lib/librte_vhost/socket.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/lib/librte_vhost/socket.c b/lib/librte_vhost/socket.c
> index d63031747..43da1c51b 100644
> --- a/lib/librte_vhost/socket.c
> +++ b/lib/librte_vhost/socket.c
> @@ -293,16 +293,16 @@ vhost_user_read_cb(int connfd, void *dat, int *remove)
> 		if (vsocket->notify_ops->destroy_connection)
> 			vsocket->notify_ops->destroy_connection(conn->vid);
> 
> +		if (vsocket->reconnect) {
> +			create_unix_socket(vsocket);
> +			vhost_user_start_client(vsocket);
> +		}
> +
> 		pthread_mutex_lock(&vsocket->conn_mutex);
> 		TAILQ_REMOVE(&vsocket->conn_list, conn, next);
> 		pthread_mutex_unlock(&vsocket->conn_mutex);
> 
> 		free(conn);
> -
> -		if (vsocket->reconnect) {
> -			create_unix_socket(vsocket);
> -			vhost_user_start_client(vsocket);
> -		}
> 	}
> }
> 
> -- 
> 2.14.3 (Apple Git-98)
> 

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

* [dpdk-stable] [PATCH] vhost: fix crash on unregistering in client mode
@ 2018-09-07  0:53 Qiang Zhou
  0 siblings, 0 replies; 4+ messages in thread
From: Qiang Zhou @ 2018-09-07  0:53 UTC (permalink / raw)
  To: dev; +Cc: Qiang Zhou, stable

when rte_vhost_driver_unregister delete the connection fd,
the fd lock will prevent the vsocket to be freed. But when
vhost_user_msg_handler return error, it will delete vsocket
conn_list. And then the fd lock will become invalid. So the
vsocket will be freed in rte_vhost_drivere_unregister and
the vhost_user_read_cb will reconnect.

To fix this:
move delete vsocket conn after reconnect

Cc: stable@dpdk.org

Signed-off-by: Qiang Zhou <zhouqiang2633@gmail.com>
---
 lib/librte_vhost/socket.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/lib/librte_vhost/socket.c b/lib/librte_vhost/socket.c
index d63031747..43da1c51b 100644
--- a/lib/librte_vhost/socket.c
+++ b/lib/librte_vhost/socket.c
@@ -293,16 +293,16 @@ vhost_user_read_cb(int connfd, void *dat, int *remove)
 		if (vsocket->notify_ops->destroy_connection)
 			vsocket->notify_ops->destroy_connection(conn->vid);
 
+		if (vsocket->reconnect) {
+			create_unix_socket(vsocket);
+			vhost_user_start_client(vsocket);
+		}
+
 		pthread_mutex_lock(&vsocket->conn_mutex);
 		TAILQ_REMOVE(&vsocket->conn_list, conn, next);
 		pthread_mutex_unlock(&vsocket->conn_mutex);
 
 		free(conn);
-
-		if (vsocket->reconnect) {
-			create_unix_socket(vsocket);
-			vhost_user_start_client(vsocket);
-		}
 	}
 }
 
-- 
2.14.3 (Apple Git-98)

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

* [dpdk-stable] [PATCH] vhost: fix crash on unregistering in client mode
@ 2018-09-06 13:19 Qiang Zhou
  0 siblings, 0 replies; 4+ messages in thread
From: Qiang Zhou @ 2018-09-06 13:19 UTC (permalink / raw)
  To: dev; +Cc: Qiang Zhou, stable

when rte_vhost_driver_unregister delete the connection fd,
the fd lock will prevent the vsocket to be freed. But when vhost_user_msg_handler
return error, it will delete vsocket conn_list. And then the fd lock will become
invalid. So the vsocket will be freed in rte_vhost_drivere_unregister and the
vhost_user_read_cb will reconnect.

To fix this:
move delete vsocket conn after reconnect

Cc: stable@dpdk.org

Signed-off-by: Qiang Zhou <zhouqiang2633@gmail.com>
---
 lib/librte_vhost/socket.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/lib/librte_vhost/socket.c b/lib/librte_vhost/socket.c
index d63031747..43da1c51b 100644
--- a/lib/librte_vhost/socket.c
+++ b/lib/librte_vhost/socket.c
@@ -293,16 +293,16 @@ vhost_user_read_cb(int connfd, void *dat, int *remove)
 		if (vsocket->notify_ops->destroy_connection)
 			vsocket->notify_ops->destroy_connection(conn->vid);
 
+		if (vsocket->reconnect) {
+			create_unix_socket(vsocket);
+			vhost_user_start_client(vsocket);
+		}
+
 		pthread_mutex_lock(&vsocket->conn_mutex);
 		TAILQ_REMOVE(&vsocket->conn_list, conn, next);
 		pthread_mutex_unlock(&vsocket->conn_mutex);
 
 		free(conn);
-
-		if (vsocket->reconnect) {
-			create_unix_socket(vsocket);
-			vhost_user_start_client(vsocket);
-		}
 	}
 }
 
-- 
2.14.3 (Apple Git-98)

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

end of thread, other threads:[~2018-10-04 21:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-06 13:18 [dpdk-stable] [PATCH] vhost: fix crash on unregistering in client mode Qiang Zhou
2018-10-04 21:23 ` Yongseok Koh
2018-09-06 13:19 Qiang Zhou
2018-09-07  0:53 Qiang Zhou

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).