Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp2907561ybe; Sun, 8 Sep 2019 03:16:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqyIIw7qiXc5bdqQ8jnjbx4tgA9Cu2N7Lq434+A+J1AjviQnAaXmKw02Il7SMWRaPpK9rGfn X-Received: by 2002:a63:2349:: with SMTP id u9mr13681166pgm.214.1567937815662; Sun, 08 Sep 2019 03:16:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567937815; cv=none; d=google.com; s=arc-20160816; b=gAmzx+xu0FGcpmzbC+pEI2fr1yOOdYvRqwyQnECBcpWw0dokOtIStE+a/ZOI8IoydJ dXvQ11nFqTiZSExy8vGWgW5/jcCEiDJPKHn2+BE4czoIaT/LQlfVA3mITna4ytxPiNJJ NRFUAxmo4OcwfBYyIxZETlx+SkMdSj6K0D1AGcaQ3akR/GD7Ct07dvbbqW5wLh/F86zO kwB81ykBa6FuRiYobWzg3YzSyjV5/RgSbs7b4ToanCkR8zSd6Gtlnud5li1tpNLRxoQu Z0JmsL7nwcsbHfsSBR7r/UAUjXMFftU7oSBtnwN53asgF5RxzSv1X1lu/86wt/ZExNN/ pxvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=p0dbbQMzg3UN6wOX3ZMQsfBU/LObXb+iC7X9vpXy1S0=; b=mxGEPgNKT8YBX4BH3tpb9K2AQZsdE27GZoHKWR0HgmzFQUCupjkD5FraeMKHqCfStv aPlThx1g7CcKITJGFEldhHiNCUzhzefHrVC3gtC1esn5U2caxYChTCgeM3AxAw/ohqNV uQl0BbLnD9ENVuUrE4aDf39YR2YCIPp7yxiHJYk8K1gT12NeeFs5CqjKDD0b7WDCzaDx V/b6yn2pWo615wZklscu/n1wNoOIg5/Ur7Y1DWxFX2Vb8qC30+QseAZM4ezFZuR6M5jN gvl4Ol+MmjzfrIpPhppdO2M71zG2z/nD3URvNE2XL0z/iDQkkWUvP7id/2bqFDC9X3zD 262Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=lKG6gBsY; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w19si10899986pfi.200.2019.09.08.03.16.40; Sun, 08 Sep 2019 03:16:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=lKG6gBsY; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2406147AbfIFXsK (ORCPT + 99 others); Fri, 6 Sep 2019 19:48:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:42542 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405441AbfIFXsK (ORCPT ); Fri, 6 Sep 2019 19:48:10 -0400 Received: from localhost (unknown [104.132.0.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8D1C620842; Fri, 6 Sep 2019 23:48:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567813689; bh=YaTVDRKaWZp6RtZVWL7bD2dch2Eb2d4uXQ0xopsEZSk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=lKG6gBsYXRoodg6TXLwPJ0ERZ57ieDDf0M0hfRwkNClvG6iJDRgcUtfI+nZfsJhem bUj5rEwZHZIMACq3HZmc/H3689dIyRdJyRBaC3JCjg4msPyOqKreuOHo4K7oApOp9p odNdszgFPA3IoHoi/PePG68AQu64WPepnxTwH9CQ= Date: Fri, 6 Sep 2019 16:48:08 -0700 From: Jaegeuk Kim To: Chao Yu Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, chao@kernel.org Subject: Re: [PATCH] f2fs: fix to avoid accessing uninitialized field of inode page in is_alive() Message-ID: <20190906234808.GC71848@jaegeuk-macbookpro.roam.corp.google.com> References: <20190906105426.109151-1-yuchao0@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190906105426.109151-1-yuchao0@huawei.com> User-Agent: Mutt/1.8.2 (2017-04-18) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 09/06, Chao Yu wrote: > If inode is newly created, inode page may not synchronize with inode cache, > so fields like .i_inline or .i_extra_isize could be wrong, in below call > path, we may access such wrong fields, result in failing to migrate valid > target block. If data is valid, how can we get new inode page? > > - gc_data_segment > - is_alive > - datablock_addr > - offset_in_addr > > Fixes: 7a2af766af15 ("f2fs: enhance on-disk inode structure scalability") > Signed-off-by: Chao Yu > --- > fs/f2fs/dir.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/fs/f2fs/dir.c b/fs/f2fs/dir.c > index 765f13354d3f..b1840852967e 100644 > --- a/fs/f2fs/dir.c > +++ b/fs/f2fs/dir.c > @@ -479,6 +479,9 @@ struct page *f2fs_init_inode_metadata(struct inode *inode, struct inode *dir, > if (IS_ERR(page)) > return page; > > + /* synchronize inode page's data from inode cache */ > + f2fs_update_inode(inode, page); > + > if (S_ISDIR(inode->i_mode)) { > /* in order to handle error case */ > get_page(page); > -- > 2.18.0.rc1