Patch "macintosh/adb: fix oob read in do_adb_query() function" has been added to the 4.9-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    macintosh/adb: fix oob read in do_adb_query() function

to the 4.9-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     macintosh-adb-fix-oob-read-in-do_adb_query-function.patch
and it can be found in the queue-4.9 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 91f5770eac36c7a3cd49c6b5c81e702ac538f28b
Author: Ning Qiang <sohu0106@xxxxxxx>
Date:   Wed Jul 13 23:37:34 2022 +0800

    macintosh/adb: fix oob read in do_adb_query() function
    
    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@xxxxxxxxxx>
    Signed-off-by: Ning Qiang <sohu0106@xxxxxxx>
    Reviewed-by: Kees Cook <keescook@xxxxxxxxxxxx>
    Reviewed-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
    Acked-by: Benjamin Herrenschmidt <benh@xxxxxxxxxxxxxxxxxxx>
    Signed-off-by: Michael Ellerman <mpe@xxxxxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20220713153734.2248-1-sohu0106@xxxxxxx
    Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>

diff --git a/drivers/macintosh/adb.c b/drivers/macintosh/adb.c
index 226179b975a0..1f5db323e5a5 100644
--- 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;



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux