* oob read in do_adb_query function
@ 2022-07-13 1:54 sohu0106
2022-07-13 3:46 ` Benjamin Herrenschmidt
0 siblings, 1 reply; 2+ messages in thread
From: sohu0106 @ 2022-07-13 1:54 UTC (permalink / raw)
To: benh; +Cc: 内核安全组, linuxppc-dev
In do_adb_query function of drivers/macintosh/adb.c, req->data is copy 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.
diff --git a/adb.c b/adb.c_patch
index 73b3961..8a5604b 100644
--- a/adb.c
+++ b/adb.c_patch
@@ -647,7 +647,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-
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: oob read in do_adb_query function
2022-07-13 1:54 oob read in do_adb_query function sohu0106
@ 2022-07-13 3:46 ` Benjamin Herrenschmidt
0 siblings, 0 replies; 2+ messages in thread
From: Benjamin Herrenschmidt @ 2022-07-13 3:46 UTC (permalink / raw)
To: sohu0106; +Cc: 内核安全组, linuxppc-dev
On Wed, 2022-07-13 at 09:54 +0800, sohu0106 wrote:
>
>
> In do_adb_query function of drivers/macintosh/adb.c, req->data is
> copy 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.
Thanks ! Can you send this with a proper Signed-off-by so we can apply
directly ?
Cheers,
Ben.
>
>
> diff --git a/adb.c b/adb.c_patch
> index 73b3961..8a5604b 100644
> --- a/adb.c
> +++ b/adb.c_patch
> @@ -647,7 +647,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-
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-07-13 4:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-13 1:54 oob read in do_adb_query function sohu0106
2022-07-13 3:46 ` Benjamin Herrenschmidt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).