Message ID | 1469027737-22624-1-git-send-email-luis.henriques@canonical.com |
---|---|
State | New |
Headers | show |
diff --git a/drivers/misc/mic/host/mic_virtio.c b/drivers/misc/mic/host/mic_virtio.c index 58b107a24a8b..3314b2f285b2 100644 --- a/drivers/misc/mic/host/mic_virtio.c +++ b/drivers/misc/mic/host/mic_virtio.c @@ -556,6 +556,12 @@ static int mic_copy_dp_entry(struct mic_vdev *mvdev, goto exit; } + /* Ensure desc has not changed between the two reads */ + if (memcmp(&dd, dd_config, sizeof(dd))) { + ret = -EINVAL; + goto exit; + } + vqconfig = mic_vq_config(dd_config); for (i = 0; i < dd.num_vq; i++) { if (le16_to_cpu(vqconfig[i].num) > MIC_MAX_VRING_ENTRIES) {