diff options
author | Michael S. Tsirkin <mst@redhat.com> | 2013-04-28 10:12:08 -0400 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2013-05-01 03:02:54 -0400 |
commit | 150b9e51ae975ca1fe468c565870fbc4a96e0574 (patch) | |
tree | c708d0c69807c7ac4eb14e86498536c5ec1c6c82 /drivers/vhost/vhost.h | |
parent | 061b16cfe3dc7a106dd29b76f6355d84464d126c (diff) |
vhost: fix error handling in RESET_OWNER ioctl
RESET_OWNER ioctl would leave the fd in a bad state if
memory allocation failed: device is stopped
but owner is not reset. Make state changes
after allocating memory, such that a failed
ioctl has no effect.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'drivers/vhost/vhost.h')
-rw-r--r-- | drivers/vhost/vhost.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h index 1627eec0ca25..b58f4ae82cb8 100644 --- a/drivers/vhost/vhost.h +++ b/drivers/vhost/vhost.h | |||
@@ -136,7 +136,8 @@ struct vhost_dev { | |||
136 | 136 | ||
137 | long vhost_dev_init(struct vhost_dev *, struct vhost_virtqueue **vqs, int nvqs); | 137 | long vhost_dev_init(struct vhost_dev *, struct vhost_virtqueue **vqs, int nvqs); |
138 | long vhost_dev_check_owner(struct vhost_dev *); | 138 | long vhost_dev_check_owner(struct vhost_dev *); |
139 | long vhost_dev_reset_owner(struct vhost_dev *); | 139 | struct vhost_memory *vhost_dev_reset_owner_prepare(void); |
140 | void vhost_dev_reset_owner(struct vhost_dev *, struct vhost_memory *); | ||
140 | void vhost_dev_cleanup(struct vhost_dev *, bool locked); | 141 | void vhost_dev_cleanup(struct vhost_dev *, bool locked); |
141 | void vhost_dev_stop(struct vhost_dev *); | 142 | void vhost_dev_stop(struct vhost_dev *); |
142 | long vhost_dev_ioctl(struct vhost_dev *, unsigned int ioctl, void __user *argp); | 143 | long vhost_dev_ioctl(struct vhost_dev *, unsigned int ioctl, void __user *argp); |