Unverified Commit c4873f03 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!5189 vhost_vdpa: Fix the error of not executing atomic_dec

Merge Pull Request from: @lyx521code 
 
driver inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I98AT9



---------------------------------------------------------------------

In the vhost_vdpa_open function, if atomic_cmpxchg succeeds but
vhost_vdpa_alloc_domain fails, directly returning to the user space
without performing the atomic_dec operation will lead to an exception

Signed-off-by: default avatarYuxue Liu <yuxue.liu@jaguarmicro.com>
 
Link:https://gitee.com/openeuler/kernel/pulls/5189

 

Reviewed-by: default avatarJialin Zhang <zhangjialin11@huawei.com>
Signed-off-by: default avatarJialin Zhang <zhangjialin11@huawei.com>
parents dc5f5974 2749fb1b
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -1493,7 +1493,7 @@ static int vhost_vdpa_open(struct inode *inode, struct file *filep)
		return -EBUSY;
	r = vhost_vdpa_alloc_domain(v);
	if (r)
		return r;
		goto close;

	nvqs = v->nvqs;
	r = vhost_vdpa_reset(v, VDPA_DEV_RESET_OPEN);
@@ -1522,6 +1522,7 @@ static int vhost_vdpa_open(struct inode *inode, struct file *filep)

err:
	vhost_vdpa_free_domain(v);
close:
	atomic_dec(&v->opened);
	return r;
}