]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.19-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 8 Aug 2022 14:01:03 +0000 (16:01 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 8 Aug 2022 14:01:03 +0000 (16:01 +0200)
added patches:
macintosh-adb-fix-oob-read-in-do_adb_query-function.patch

queue-4.19/macintosh-adb-fix-oob-read-in-do_adb_query-function.patch [new file with mode: 0644]
queue-4.19/series

diff --git a/queue-4.19/macintosh-adb-fix-oob-read-in-do_adb_query-function.patch b/queue-4.19/macintosh-adb-fix-oob-read-in-do_adb_query-function.patch
new file mode 100644 (file)
index 0000000..91b7d5c
--- /dev/null
@@ -0,0 +1,37 @@
+From fd97e4ad6d3b0c9fce3bca8ea8e6969d9ce7423b Mon Sep 17 00:00:00 2001
+From: Ning Qiang <sohu0106@126.com>
+Date: Wed, 13 Jul 2022 23:37:34 +0800
+Subject: macintosh/adb: fix oob read in do_adb_query() function
+
+From: Ning Qiang <sohu0106@126.com>
+
+commit fd97e4ad6d3b0c9fce3bca8ea8e6969d9ce7423b upstream.
+
+In do_adb_query() function of drivers/macintosh/adb.c, req->data is copied
+form userland. The parameter "req->data[2]" is missing check, the array
+size of adb_handler[] is 16, so adb_handler[req->data[2]].original_address and
+adb_handler[req->data[2]].handler_id will lead to oob read.
+
+Cc: stable <stable@kernel.org>
+Signed-off-by: Ning Qiang <sohu0106@126.com>
+Reviewed-by: Kees Cook <keescook@chromium.org>
+Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
+Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
+Link: https://lore.kernel.org/r/20220713153734.2248-1-sohu0106@126.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/macintosh/adb.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/macintosh/adb.c
++++ b/drivers/macintosh/adb.c
+@@ -645,7 +645,7 @@ do_adb_query(struct adb_request *req)
+       switch(req->data[1]) {
+       case ADB_QUERY_GETDEVINFO:
+-              if (req->nbytes < 3)
++              if (req->nbytes < 3 || req->data[2] >= 16)
+                       break;
+               mutex_lock(&adb_handler_mutex);
+               req->reply[0] = adb_handler[req->data[2]].original_address;
index e02ed142d723b19793bde64ad20099c17fb0c31c..6a4e018a88e5958785e6072c126c162e1451dfc7 100644 (file)
@@ -27,3 +27,4 @@ mt7601u-add-usb-device-id-for-some-versions-of-xiaodu-wifi-dongle.patch
 scsi-core-fix-race-between-handling-sts_resource-and-completion.patch
 acpi-video-force-backlight-native-for-some-tongfang-devices.patch
 acpi-video-shortening-quirk-list-by-identifying-clevo-by-board_name-only.patch
+macintosh-adb-fix-oob-read-in-do_adb_query-function.patch