46 lines
1.6 KiB
Diff
46 lines
1.6 KiB
Diff
From d0ddcea59aa9406e9fac5ca1809a77f60a4bc9d9 Mon Sep 17 00:00:00 2001
|
|
From: Josh Boyer <jwboyer@fedoraproject.org>
|
|
Date: Tue, 28 Jun 2016 09:54:56 -0400
|
|
Subject: [PATCH] misc: mic: Fix for double fetch security bug in
|
|
mic_copy_dp_entry
|
|
|
|
commit 9bf292bfca94694a721449e3fd752493856710f6 upstream
|
|
|
|
The MIC 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.
|
|
|
|
[Backported to linux-4.5.y by Josh Boyer]
|
|
|
|
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=116651
|
|
Reported by: Pengfei Wang <wpengfeinudt@gmail.com>
|
|
Reviewed-by: Sudeep Dutt <sudeep.dutt@intel.com>
|
|
Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
|
|
Cc: stable <stable@vger.kernel.org>
|
|
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
|
Signed-off-by: Josh Boyer <jwboyer@fedoraproject.org>
|
|
---
|
|
drivers/misc/mic/host/mic_virtio.c | 5 +++++
|
|
1 file changed, 5 insertions(+)
|
|
|
|
diff --git a/drivers/misc/mic/host/mic_virtio.c b/drivers/misc/mic/host/mic_virtio.c
|
|
index 58b107a24a8b..7a64f5a619d6 100644
|
|
--- a/drivers/misc/mic/host/mic_virtio.c
|
|
+++ b/drivers/misc/mic/host/mic_virtio.c
|
|
@@ -555,6 +555,11 @@ static int mic_copy_dp_entry(struct mic_vdev *mvdev,
|
|
__func__, __LINE__, ret);
|
|
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++) {
|
|
--
|
|
2.5.5
|
|
|