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 X-Spam-Level: X-Spam-Status: No, score=-13.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A215EC433B4 for ; Mon, 26 Apr 2021 08:40:14 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id DE3B560233 for ; Mon, 26 Apr 2021 08:40:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DE3B560233 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linux-erofs-bounces+linux-erofs=archiver.kernel.org@lists.ozlabs.org Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4FTJHc3r2vz30Ft for ; Mon, 26 Apr 2021 18:40:12 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=lH5OXRYL; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=linuxfoundation.org (client-ip=198.145.29.99; helo=mail.kernel.org; envelope-from=gregkh@linuxfoundation.org; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=lH5OXRYL; dkim-atps=neutral Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4FTJHC6ZyQz300S for ; Mon, 26 Apr 2021 18:39:50 +1000 (AEST) Received: by mail.kernel.org (Postfix) with ESMTPSA id 62FBE61026; Mon, 26 Apr 2021 08:39:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1619426386; bh=qmBzYEu9Br729+JjbL2iaRcxwkLblYZWZBSJZ2/X8/Y=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=lH5OXRYLfOWxZiREksdAwmEnsT8uPwGz1gPWQxo+539jCrJHkiAvwHr79nBWap9aX mizyB0PaixVznKf6/4OzIBR3ioif4mYLagBPE90oNdwlVfOCq7W6Y8u9WDyD35tYju kksypEFnXbtXbrgAl00EFoI1M9bzz0rizcMQQbmw= Date: Mon, 26 Apr 2021 10:39:44 +0200 From: Greg Kroah-Hartman To: Gao Xiang Subject: Re: [PATCH for-4.19] erofs: fix extended inode could cross boundary Message-ID: References: <20210426082933.4040996-1-hsiangkao@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210426082933.4040996-1-hsiangkao@redhat.com> X-BeenThere: linux-erofs@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development of Linux EROFS file system List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-erofs@lists.ozlabs.org, stable@vger.kernel.org Errors-To: linux-erofs-bounces+linux-erofs=archiver.kernel.org@lists.ozlabs.org Sender: "Linux-erofs" On Mon, Apr 26, 2021 at 04:29:33PM +0800, Gao Xiang wrote: > commit 0dcd3c94e02438f4a571690e26f4ee997524102a upstream. > > Each ondisk inode should be aligned with inode slot boundary > (32-byte alignment) because of nid calculation formula, so all > compact inodes (32 byte) cannot across page boundary. However, > extended inode is now 64-byte form, which can across page boundary > in principle if the location is specified on purpose, although > it's hard to be generated by mkfs due to the allocation policy > and rarely used by Android use case now mainly for > 4GiB files. > > For now, only two fields `i_ctime_nsec` and `i_nlink' couldn't > be read from disk properly and cause out-of-bound memory read > with random value. > > Let's fix now. > > Fixes: 431339ba9042 ("staging: erofs: add inode operations") > Cc: # 4.19+ > Link: https://lore.kernel.org/r/20200729175801.GA23973@xiangao.remote.csb > Reviewed-by: Chao Yu > [ Gao Xiang: resolve non-trivial conflicts for latest 4.19.y. ] > Signed-off-by: Gao Xiang > --- > drivers/staging/erofs/inode.c | 135 ++++++++++++++++++++++------------ > 1 file changed, 90 insertions(+), 45 deletions(-) Thanks for the backport, I'll queue it up after this latest round of stable kernels is released later this week. greg k-h