From: Qiang Zhou <zhouqiang2633@gmail.com>
To: dev@dpdk.org
Cc: Qiang Zhou <zhouqiang2633@gmail.com>, stable@dpdk.org
Subject: [dpdk-dev] [PATCH] vhost: fix crash on unregistering in client mode
Date: Thu, 6 Sep 2018 21:19:41 +0800 [thread overview]
Message-ID: <20180906131941.95267-1-zhouqiang2633@gmail.com> (raw)
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)
next reply other threads:[~2018-09-06 13:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-06 13:19 Qiang Zhou [this message]
2018-09-07 0:53 Qiang Zhou
2018-09-27 15:54 ` Maxime Coquelin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180906131941.95267-1-zhouqiang2633@gmail.com \
--to=zhouqiang2633@gmail.com \
--cc=dev@dpdk.org \
--cc=stable@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).