diff options
author | Michael S. Tsirkin <mst@redhat.com> | 2014-11-27 13:45:58 +0200 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2014-12-09 12:05:24 +0200 |
commit | 93d389f82078cf7197152fb10d21977da0883420 (patch) | |
tree | c168e5be2acd4e257212006a710af14df2185d80 /drivers/s390 | |
parent | d025477368792b272802146a86e41f81a54d8a19 (diff) | |
download | linux-exynos-93d389f82078cf7197152fb10d21977da0883420.tar.gz linux-exynos-93d389f82078cf7197152fb10d21977da0883420.tar.bz2 linux-exynos-93d389f82078cf7197152fb10d21977da0883420.zip |
virtio: assert 32 bit features in transports
At this point, no transports set any of the high 32 feature bits.
Since transports generally can't (yet) cope with such bits, add BUG_ON
checks to make sure they are not set by mistake.
Based on rproc patch by Rusty.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Diffstat (limited to 'drivers/s390')
-rw-r--r-- | drivers/s390/kvm/kvm_virtio.c | 3 | ||||
-rw-r--r-- | drivers/s390/kvm/virtio_ccw.c | 3 |
2 files changed, 6 insertions, 0 deletions
diff --git a/drivers/s390/kvm/kvm_virtio.c b/drivers/s390/kvm/kvm_virtio.c index 2336c7e3b0cf..f5575ccdbb65 100644 --- a/drivers/s390/kvm/kvm_virtio.c +++ b/drivers/s390/kvm/kvm_virtio.c @@ -103,6 +103,9 @@ static void kvm_finalize_features(struct virtio_device *vdev) /* Give virtio_ring a chance to accept features. */ vring_transport_features(vdev); + /* Make sure we don't have any features > 32 bits! */ + BUG_ON((u32)vdev->features != vdev->features); + memset(out_features, 0, desc->feature_len); bits = min_t(unsigned, desc->feature_len, sizeof(vdev->features)) * 8; for (i = 0; i < bits; i++) { diff --git a/drivers/s390/kvm/virtio_ccw.c b/drivers/s390/kvm/virtio_ccw.c index 56d78956a8cb..244d611a0df2 100644 --- a/drivers/s390/kvm/virtio_ccw.c +++ b/drivers/s390/kvm/virtio_ccw.c @@ -714,6 +714,9 @@ static void virtio_ccw_finalize_features(struct virtio_device *vdev) /* Give virtio_ring a chance to accept features. */ vring_transport_features(vdev); + /* Make sure we don't have any features > 32 bits! */ + BUG_ON((u32)vdev->features != vdev->features); + features->index = 0; features->features = cpu_to_le32(vdev->features); /* Write the feature bits to the host. */ |