From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EF470C433EF for ; Wed, 13 Jul 2022 14:11:34 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4LjfgT27T5z3cdc for ; Thu, 14 Jul 2022 00:11:33 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=kroah.com header.i=@kroah.com header.a=rsa-sha256 header.s=fm3 header.b=ogzxYLvo; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm3 header.b=n53SJw4a; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=kroah.com (client-ip=64.147.123.20; helo=wout4-smtp.messagingengine.com; envelope-from=greg@kroah.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kroah.com header.i=@kroah.com header.a=rsa-sha256 header.s=fm3 header.b=ogzxYLvo; dkim=pass (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm3 header.b=n53SJw4a; dkim-atps=neutral X-Greylist: delayed 447 seconds by postgrey-1.36 at boromir; Thu, 14 Jul 2022 00:10:51 AEST Received: from wout4-smtp.messagingengine.com (wout4-smtp.messagingengine.com [64.147.123.20]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4Ljffg5mwxz3c2G for ; Thu, 14 Jul 2022 00:10:51 +1000 (AEST) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id 496753200962; Wed, 13 Jul 2022 10:03:18 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Wed, 13 Jul 2022 10:03:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kroah.com; h=cc :cc:content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to; s=fm3; t=1657720997; x=1657807397; bh=L3ybPyzca4 nzTBAjBDD3y8s9vn3LOipcGuuEt3Q0f60=; b=ogzxYLvoDajdsTmQ3Jdh/OneP6 82anTfsFp9ig1wApHyLFo0ZfgxyjzSvdDuQw1mcgAgimetVb74fWdIwd7jKTesDP S5hBqprYWmK6pEK9fc2pYHmmuAzloX24NtDlDH4wFmbbgAKkyGM3tINYrGSmiGk0 7JFBGAjBdG6lcDKIwuHqHndZbS6LR0SlteK5qmPzpZXETW76mId5ZVJJvNWkrgHd MooSD7zOv5DShL7icGUChSvVkoDhtSYwUzRbLgBAWodw54lMPoEWsIygRm6AX8II 4c0slTAsg9ISxBvgX83Vgu0HJ5cNmzoxJ8hdnq5km+Ugce1Bdd0pjtRxbcgQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:feedback-id :feedback-id:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:sender:subject:subject:to:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; t=1657720997; x=1657807397; bh=L3ybPyzca4nzTBAjBDD3y8s9vn3L OipcGuuEt3Q0f60=; b=n53SJw4axe3Pd1UanXaP5XMciIXaPkbJdbITZzSNq3cL S7mQWRB6W0JVMCq7lHGC5oeQ0ZDGiGSnovNjxvt8cVV6jj5AZeZ/wATt9BrC/bFC Pi12CyaGM6F1KvRM/yn98U0tkqs4yZZ1gVHwQGbjxjIHYr0aAcyPE5Dh7Tic2380 g4a3BFF8sujBEGNz5UDnWfrTHWUft+G9IRkf8n65tULU0D+AtTcbb13OUKcgH6ml b3WUlDeDoYpI9Yopv8Fr4If6ZfDsl0ECU/z7K1egRgO02zvMlF0g16nen/+RbZWe wFLMrMgRNT/mJjCmyDCafAUB2v02aTaDIhF8WWhbag== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrudejjedgjeduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpeffhffvvefukfhfgggtuggjsehttd ertddttddvnecuhfhrohhmpefirhgvghcumffjuceoghhrvghgsehkrhhorghhrdgtohhm qeenucggtffrrghtthgvrhhnpeehgedvvedvleejuefgtdduudfhkeeltdeihfevjeekje euhfdtueefhffgheekteenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgr ihhlfhhrohhmpehgrhgvgheskhhrohgrhhdrtghomh X-ME-Proxy: Feedback-ID: i787e41f1:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 13 Jul 2022 10:03:15 -0400 (EDT) Date: Wed, 13 Jul 2022 16:03:11 +0200 From: Greg KH To: NAME Subject: Re: [PATCH] macintosh:fix oob read in do_adb_query function Message-ID: References: <20220713134037.2331-1-sohu0106@126.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220713134037.2331-1-sohu0106@126.com> X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: security@kernel.org, linuxppc-dev@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On Wed, Jul 13, 2022 at 09:40:37PM +0800, NAME wrote: > From: sohu0106 For obvious reasons, we need a real name here, and in the signed-off-by line. > 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. You can use all 72 columns, if you want to re-wrap these lines when you resend. > > Signed-off-by: sohu0106 > --- > drivers/macintosh/adb.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/macintosh/adb.c b/drivers/macintosh/adb.c > index 439fab4eaa85..1bbb9ca08d40 100644 > --- a/drivers/macintosh/adb.c > +++ b/drivers/macintosh/adb.c > @@ -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) Shouldn't 16 be the array size instead of having this hard coded to a magic number? Something like "sizeof(adb_handler) / sizeof(struct adb_handler)"? Maybe not, that's messy, your choice. thanks, greg k-h