Commit 2749fb1b authored by lyx634449800's avatar lyx634449800
Browse files

vhost_vdpa: Fix the error of not executing atomic_dec

driver inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I98AT9


CVE: NA

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

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 avatarlyx634449800 <yuxue.liu@jaguarmicro.com>
parent 4fa70990
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;
}