linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: sohu0106 <sohu0106@126.com>
Cc: 内核安全组 <security@kernel.org>, linuxppc-dev@lists.ozlabs.org
Subject: Re: oob read in do_adb_query function
Date: Wed, 13 Jul 2022 13:46:04 +1000	[thread overview]
Message-ID: <68b18cf30dc3fb4d78a74edf390fcc5da6f61114.camel@kernel.crashing.org> (raw)
In-Reply-To: <74db5889.1519.181f54412b2.Coremail.sohu0106@126.com>

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-


      reply	other threads:[~2022-07-13  3:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-13  1:54 oob read in do_adb_query function sohu0106
2022-07-13  3:46 ` Benjamin Herrenschmidt [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=68b18cf30dc3fb4d78a74edf390fcc5da6f61114.camel@kernel.crashing.org \
    --to=benh@kernel.crashing.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=security@kernel.org \
    --cc=sohu0106@126.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).