From: Greg Kroah-Hartman Date: Mon, 8 Aug 2022 14:00:49 +0000 (+0200) Subject: 4.9-stable patches X-Git-Tag: v4.19.255~10 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0254b61534c8eed7de7cba10a4afa4d586bf7308;p=thirdparty%2Fkernel%2Fstable-queue.git 4.9-stable patches added patches: macintosh-adb-fix-oob-read-in-do_adb_query-function.patch --- diff --git a/queue-4.9/macintosh-adb-fix-oob-read-in-do_adb_query-function.patch b/queue-4.9/macintosh-adb-fix-oob-read-in-do_adb_query-function.patch new file mode 100644 index 00000000000..ae976416f55 --- /dev/null +++ b/queue-4.9/macintosh-adb-fix-oob-read-in-do_adb_query-function.patch @@ -0,0 +1,37 @@ +From fd97e4ad6d3b0c9fce3bca8ea8e6969d9ce7423b Mon Sep 17 00:00:00 2001 +From: Ning Qiang +Date: Wed, 13 Jul 2022 23:37:34 +0800 +Subject: macintosh/adb: fix oob read in do_adb_query() function + +From: Ning Qiang + +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 +Signed-off-by: Ning Qiang +Reviewed-by: Kees Cook +Reviewed-by: Greg Kroah-Hartman +Acked-by: Benjamin Herrenschmidt +Signed-off-by: Michael Ellerman +Link: https://lore.kernel.org/r/20220713153734.2248-1-sohu0106@126.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/macintosh/adb.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/macintosh/adb.c ++++ b/drivers/macintosh/adb.c +@@ -650,7 +650,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; diff --git a/queue-4.9/series b/queue-4.9/series index fbfc3ad8c81..ce94b4cb78d 100644 --- a/queue-4.9/series +++ b/queue-4.9/series @@ -21,3 +21,4 @@ init-main.c-extract-early-boot-entropy-from-the-passed-cmdline.patch acpi-video-force-backlight-native-for-some-tongfang-devices.patch acpi-video-shortening-quirk-list-by-identifying-clevo-by-board_name-only.patch random-only-call-boot_init_stack_canary-once.patch +macintosh-adb-fix-oob-read-in-do_adb_query-function.patch