[dpdk-dev,v6,05/13] vhost-user: handle VHOST_USER_RESET_OWNER correctly

Message ID 1444369572-1157-6-git-send-email-yuanhan.liu@linux.intel.com (mailing list archive)
State Superseded, archived
Headers

Commit Message

Yuanhan Liu Oct. 9, 2015, 5:46 a.m. UTC
Destroy corresponding device when a VHOST_USER_RESET_OWNER message is
received, otherwise, the vhost-switch would still try to access vq
of that device, which results to SIGSEG fault, and let vhost-switch
crash in the end.

Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
---
 lib/librte_vhost/vhost_user/vhost-net-user.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Thomas Monjalon Oct. 20, 2015, 7:03 a.m. UTC | #1
2015-10-09 13:46, Yuanhan Liu:
> Destroy corresponding device when a VHOST_USER_RESET_OWNER message is
> received, otherwise, the vhost-switch would still try to access vq
> of that device, which results to SIGSEG fault, and let vhost-switch
> crash in the end.

It is a fix, so the title should look like:
	vhost: fix crash when receiving VHOST_USER_RESET_OWNER
and there should be a "Fixes:" tag.

Please could you also review the related patches from Jerome Jutteau?
	http://dpdk.org/dev/patchwork/project/dpdk/list/?submitter=354

Thanks
  
Yuanhan Liu Oct. 20, 2015, 7:14 a.m. UTC | #2
On Tue, Oct 20, 2015 at 09:03:48AM +0200, Thomas Monjalon wrote:
> 2015-10-09 13:46, Yuanhan Liu:
> > Destroy corresponding device when a VHOST_USER_RESET_OWNER message is
> > received, otherwise, the vhost-switch would still try to access vq
> > of that device, which results to SIGSEG fault, and let vhost-switch
> > crash in the end.
> 
> It is a fix, so the title should look like:
> 	vhost: fix crash when receiving VHOST_USER_RESET_OWNER
> and there should be a "Fixes:" tag.

Got it.

> 
> Please could you also review the related patches from Jerome Jutteau?
> 	http://dpdk.org/dev/patchwork/project/dpdk/list/?submitter=354


I've already reviewed v1 in the first time, giving him a series ACK.
However, I had a minor comment, which will not affect my ACK, and he
updated his patch to v2.

Maybe I should make another ACK in this v2.

	--yliu
  

Patch

diff --git a/lib/librte_vhost/vhost_user/vhost-net-user.c b/lib/librte_vhost/vhost_user/vhost-net-user.c
index 8675cd4..f802b77 100644
--- a/lib/librte_vhost/vhost_user/vhost-net-user.c
+++ b/lib/librte_vhost/vhost_user/vhost-net-user.c
@@ -379,7 +379,7 @@  vserver_message_handler(int connfd, void *dat, int *remove)
 		ops->set_owner(ctx);
 		break;
 	case VHOST_USER_RESET_OWNER:
-		ops->reset_owner(ctx);
+		user_destroy_device(ctx);
 		break;
 
 	case VHOST_USER_SET_MEM_TABLE: