[CVE-2016-5728][Trusty, Vivid, Xenial] misc: mic: Fix for double fetch security bug in VOP driver

Luis Henriques luis.henriques at canonical.com
Wed Jul 20 15:15:37 UTC 2016


From: Ashutosh Dixit <ashutosh.dixit at intel.com>

The MIC VOP driver does two successive reads from user space to read a
variable length data structure. Kernel memory corruption can result if
the data structure changes between the two reads. This patch disallows
the chance of this happening.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=116651
Reported by: Pengfei Wang <wpengfeinudt at gmail.com>
Reviewed-by: Sudeep Dutt <sudeep.dutt at intel.com>
Signed-off-by: Ashutosh Dixit <ashutosh.dixit at intel.com>
Cc: stable <stable at vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
(backported from commit 9bf292bfca94694a721449e3fd752493856710f6)
[ luis: apply changes to mic_copy_dp_entry(), in file
  drivers/misc/mic/host/mic_virtio.c; adjust context ]
CVE-2016-5728
Signed-off-by: Luis Henriques <luis.henriques at canonical.com>
---
 drivers/misc/mic/host/mic_virtio.c | 6 ++++++
 1 file changed, 6 insertions(+)

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) {




More information about the kernel-team mailing list