search for: vhost_log_access_ok

Displaying 20 results from an estimated 195 matches for "vhost_log_access_ok".

2016 Aug 02
1
[PATCH -next] vhost: fix missing unlock on error in vhost_net_set_features()
...rs/vhost/net.c index c6bdd90..5dc128a 100644 --- a/drivers/vhost/net.c +++ b/drivers/vhost/net.c @@ -1104,13 +1104,12 @@ static int vhost_net_set_features(struct vhost_net *n, u64 features) } mutex_lock(&n->dev.mutex); if ((features & (1 << VHOST_F_LOG_ALL)) && - !vhost_log_access_ok(&n->dev)) { - mutex_unlock(&n->dev.mutex); - return -EFAULT; - } + !vhost_log_access_ok(&n->dev)) + goto out_unlock; + if ((features & (1ULL << VIRTIO_F_IOMMU_PLATFORM))) { if (vhost_init_device_iotlb(&n->dev, true)) - return -EFAULT; + goto out...
2016 Aug 02
1
[PATCH -next] vhost: fix missing unlock on error in vhost_net_set_features()
...rs/vhost/net.c index c6bdd90..5dc128a 100644 --- a/drivers/vhost/net.c +++ b/drivers/vhost/net.c @@ -1104,13 +1104,12 @@ static int vhost_net_set_features(struct vhost_net *n, u64 features) } mutex_lock(&n->dev.mutex); if ((features & (1 << VHOST_F_LOG_ALL)) && - !vhost_log_access_ok(&n->dev)) { - mutex_unlock(&n->dev.mutex); - return -EFAULT; - } + !vhost_log_access_ok(&n->dev)) + goto out_unlock; + if ((features & (1ULL << VIRTIO_F_IOMMU_PLATFORM))) { if (vhost_init_device_iotlb(&n->dev, true)) - return -EFAULT; + goto out...
2018 Apr 10
6
[PATCH v2 0/2] vhost: fix vhost_vq_access_ok() log check
v2: * Rewrote the conditional to make the vq access check clearer [Linus] * Added Patch 2 to make the return type consistent and harder to misuse [Linus] The first patch fixes the vhost virtqueue access check which was recently broken. The second patch replaces the int return type with bool to prevent future bugs. Stefan Hajnoczi (2): vhost: fix vhost_vq_access_ok() log check vhost:
2018 Apr 10
6
[PATCH v2 0/2] vhost: fix vhost_vq_access_ok() log check
v2: * Rewrote the conditional to make the vq access check clearer [Linus] * Added Patch 2 to make the return type consistent and harder to misuse [Linus] The first patch fixes the vhost virtqueue access check which was recently broken. The second patch replaces the int return type with bool to prevent future bugs. Stefan Hajnoczi (2): vhost: fix vhost_vq_access_ok() log check vhost:
2018 Apr 11
7
[PATCH v3 0/2] vhost: fix vhost_vq_access_ok() log check
v3: * Rebased onto net/master and resolved conflict [DaveM] v2: * Rewrote the conditional to make the vq access check clearer [Linus] * Added Patch 2 to make the return type consistent and harder to misuse [Linus] The first patch fixes the vhost virtqueue access check which was recently broken. The second patch replaces the int return type with bool to prevent future bugs. Stefan Hajnoczi
2018 Apr 11
7
[PATCH v3 0/2] vhost: fix vhost_vq_access_ok() log check
v3: * Rebased onto net/master and resolved conflict [DaveM] v2: * Rewrote the conditional to make the vq access check clearer [Linus] * Added Patch 2 to make the return type consistent and harder to misuse [Linus] The first patch fixes the vhost virtqueue access check which was recently broken. The second patch replaces the int return type with bool to prevent future bugs. Stefan Hajnoczi
2018 Apr 10
0
[PATCH v2 2/2] vhost: return bool from *_access_ok() functions
...id vhost_dev_cleanup(struct vhost_dev *); void vhost_dev_stop(struct vhost_dev *); long vhost_dev_ioctl(struct vhost_dev *, unsigned int ioctl, void __user *argp); long vhost_vring_ioctl(struct vhost_dev *d, int ioctl, void __user *argp); -int vhost_vq_access_ok(struct vhost_virtqueue *vq); -int vhost_log_access_ok(struct vhost_dev *); +bool vhost_vq_access_ok(struct vhost_virtqueue *vq); +bool vhost_log_access_ok(struct vhost_dev *); int vhost_get_vq_desc(struct vhost_virtqueue *, struct iovec iov[], unsigned int iov_count, diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index 93fd0c75...
2018 Apr 11
0
[PATCH v3 2/2] vhost: return bool from *_access_ok() functions
...dev_cleanup(struct vhost_dev *); void vhost_dev_stop(struct vhost_dev *); long vhost_dev_ioctl(struct vhost_dev *, unsigned int ioctl, void __user *argp); long vhost_vring_ioctl(struct vhost_dev *d, unsigned int ioctl, void __user *argp); -int vhost_vq_access_ok(struct vhost_virtqueue *vq); -int vhost_log_access_ok(struct vhost_dev *); +bool vhost_vq_access_ok(struct vhost_virtqueue *vq); +bool vhost_log_access_ok(struct vhost_dev *); int vhost_get_vq_desc(struct vhost_virtqueue *, struct iovec iov[], unsigned int iov_count, diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index fc805b7f...
2015 Apr 02
2
[PATCH v2 7/7] vhost: feature to set the vring endianness
...len = hdr_len; > } > + > + if (features & ((1ULL << VHOST_F_SET_ENDIAN_LEGACY) | > + (1ULL << VIRTIO_F_VERSION_1))) > + return -EINVAL; > + > mutex_lock(&n->dev.mutex); > if ((features & (1 << VHOST_F_LOG_ALL)) && > !vhost_log_access_ok(&n->dev)) { > diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c > index 71df240..b53e9c2 100644 > --- a/drivers/vhost/scsi.c > +++ b/drivers/vhost/scsi.c > @@ -1544,6 +1544,10 @@ static int vhost_scsi_set_features(struct vhost_scsi *vs, u64 features) > if (features...
2015 Apr 02
2
[PATCH v2 7/7] vhost: feature to set the vring endianness
...len = hdr_len; > } > + > + if (features & ((1ULL << VHOST_F_SET_ENDIAN_LEGACY) | > + (1ULL << VIRTIO_F_VERSION_1))) > + return -EINVAL; > + > mutex_lock(&n->dev.mutex); > if ((features & (1 << VHOST_F_LOG_ALL)) && > !vhost_log_access_ok(&n->dev)) { > diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c > index 71df240..b53e9c2 100644 > --- a/drivers/vhost/scsi.c > +++ b/drivers/vhost/scsi.c > @@ -1544,6 +1544,10 @@ static int vhost_scsi_set_features(struct vhost_scsi *vs, u64 features) > if (features...
2015 Apr 02
0
[PATCH v2 7/7] vhost: feature to set the vring endianness
...n, u64 features) vhost_hlen = 0; sock_hlen = hdr_len; } + + if (features & ((1ULL << VHOST_F_SET_ENDIAN_LEGACY) | + (1ULL << VIRTIO_F_VERSION_1))) + return -EINVAL; + mutex_lock(&n->dev.mutex); if ((features & (1 << VHOST_F_LOG_ALL)) && !vhost_log_access_ok(&n->dev)) { diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c index 71df240..b53e9c2 100644 --- a/drivers/vhost/scsi.c +++ b/drivers/vhost/scsi.c @@ -1544,6 +1544,10 @@ static int vhost_scsi_set_features(struct vhost_scsi *vs, u64 features) if (features & ~VHOST_SCSI_FEATURES)...
2010 Oct 11
2
[patch 1/2] vhost: potential integer overflows
...izeof *avail) + return 0; + if (num > UINT_MAX / sizeof *used->ring - sizeof *used) + return 0; + return access_ok(VERIFY_READ, desc, num * sizeof *desc) && access_ok(VERIFY_READ, avail, sizeof *avail + num * sizeof *avail->ring) && @@ -447,6 +455,9 @@ int vhost_log_access_ok(struct vhost_dev *dev) /* Caller should have vq mutex and device mutex */ static int vq_log_access_ok(struct vhost_virtqueue *vq, void __user *log_base) { + if (vq->num > UINT_MAX / sizeof *vq->used->ring - sizeof *vq->used) + return 0; + return vq_memory_access_ok(log_base, vq...
2010 Oct 11
2
[patch 1/2] vhost: potential integer overflows
...izeof *avail) + return 0; + if (num > UINT_MAX / sizeof *used->ring - sizeof *used) + return 0; + return access_ok(VERIFY_READ, desc, num * sizeof *desc) && access_ok(VERIFY_READ, avail, sizeof *avail + num * sizeof *avail->ring) && @@ -447,6 +455,9 @@ int vhost_log_access_ok(struct vhost_dev *dev) /* Caller should have vq mutex and device mutex */ static int vq_log_access_ok(struct vhost_virtqueue *vq, void __user *log_base) { + if (vq->num > UINT_MAX / sizeof *vq->used->ring - sizeof *vq->used) + return 0; + return vq_memory_access_ok(log_base, vq...
2014 Jun 05
1
[PATCH v2 1/2] vhost: move acked_features to VQs
...44 --- a/drivers/vhost/test.c +++ b/drivers/vhost/test.c @@ -241,15 +241,18 @@ done: static int vhost_test_set_features(struct vhost_test *n, u64 features) { + struct vhost_virtqueue *vq; + mutex_lock(&n->dev.mutex); if ((features & (1 << VHOST_F_LOG_ALL)) && !vhost_log_access_ok(&n->dev)) { mutex_unlock(&n->dev.mutex); return -EFAULT; } - n->dev.acked_features = features; - smp_wmb(); - vhost_test_flush(n); + vq = &n->vqs[VHOST_TEST_VQ]; + mutex_lock(&vq->mutex); + vq->acked_features = features; + mutex_unlock(&vq->mutex);...
2014 Jun 05
1
[PATCH v2 1/2] vhost: move acked_features to VQs
...44 --- a/drivers/vhost/test.c +++ b/drivers/vhost/test.c @@ -241,15 +241,18 @@ done: static int vhost_test_set_features(struct vhost_test *n, u64 features) { + struct vhost_virtqueue *vq; + mutex_lock(&n->dev.mutex); if ((features & (1 << VHOST_F_LOG_ALL)) && !vhost_log_access_ok(&n->dev)) { mutex_unlock(&n->dev.mutex); return -EFAULT; } - n->dev.acked_features = features; - smp_wmb(); - vhost_test_flush(n); + vq = &n->vqs[VHOST_TEST_VQ]; + mutex_lock(&vq->mutex); + vq->acked_features = features; + mutex_unlock(&vq->mutex);...
2009 Dec 20
0
[PATCH 2/3] vhost: add access_ok checks
...atic int vhost_net_set_features(struct vhost_net *n, u64 features) { size_t hdr_size = features & (1 << VHOST_NET_F_VIRTIO_NET_HDR) ? sizeof(struct virtio_net_hdr) : 0; int i; mutex_lock(&n->dev.mutex); + if ((features & (1 << VHOST_F_LOG_ALL)) && + !vhost_log_access_ok(&n->dev)) { + mutex_unlock(&n->dev.mutex); + return -EFAULT; + } n->dev.acked_features = features; smp_wmb(); for (i = 0; i < VHOST_NET_VQ_MAX; ++i) { @@ -554,6 +565,7 @@ static void vhost_net_set_features(struct vhost_net *n, u64 features) } vhost_net_flush(n); mu...
2009 Dec 20
0
[PATCH 2/3] vhost: add access_ok checks
...atic int vhost_net_set_features(struct vhost_net *n, u64 features) { size_t hdr_size = features & (1 << VHOST_NET_F_VIRTIO_NET_HDR) ? sizeof(struct virtio_net_hdr) : 0; int i; mutex_lock(&n->dev.mutex); + if ((features & (1 << VHOST_F_LOG_ALL)) && + !vhost_log_access_ok(&n->dev)) { + mutex_unlock(&n->dev.mutex); + return -EFAULT; + } n->dev.acked_features = features; smp_wmb(); for (i = 0; i < VHOST_NET_VQ_MAX; ++i) { @@ -554,6 +565,7 @@ static void vhost_net_set_features(struct vhost_net *n, u64 features) } vhost_net_flush(n); mu...
2018 Jun 08
3
[PATCH net] vhost_net: remove VHOST_NET_F_VIRTIO_NET_HDR support
...sock_hlen = 0; - } else { - /* socket provides vnet_hdr */ - vhost_hlen = 0; - sock_hlen = hdr_len; - } + + /* socket provides vnet_hdr */ + vhost_hlen = 0; + sock_hlen = hdr_len; + mutex_lock(&n->dev.mutex); if ((features & (1 << VHOST_F_LOG_ALL)) && !vhost_log_access_ok(&n->dev)) -- 2.7.4
2018 Jun 08
3
[PATCH net] vhost_net: remove VHOST_NET_F_VIRTIO_NET_HDR support
...sock_hlen = 0; - } else { - /* socket provides vnet_hdr */ - vhost_hlen = 0; - sock_hlen = hdr_len; - } + + /* socket provides vnet_hdr */ + vhost_hlen = 0; + sock_hlen = hdr_len; + mutex_lock(&n->dev.mutex); if ((features & (1 << VHOST_F_LOG_ALL)) && !vhost_log_access_ok(&n->dev)) -- 2.7.4
2015 Apr 02
0
[PATCH v2 7/7] vhost: feature to set the vring endianness
...> + if (features & ((1ULL << VHOST_F_SET_ENDIAN_LEGACY) | > > + (1ULL << VIRTIO_F_VERSION_1))) > > + return -EINVAL; > > + > > mutex_lock(&n->dev.mutex); > > if ((features & (1 << VHOST_F_LOG_ALL)) && > > !vhost_log_access_ok(&n->dev)) { > > diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c > > index 71df240..b53e9c2 100644 > > --- a/drivers/vhost/scsi.c > > +++ b/drivers/vhost/scsi.c > > @@ -1544,6 +1544,10 @@ static int vhost_scsi_set_features(struct vhost_scsi *vs, u64 feat...