Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1245021pxk; Fri, 25 Sep 2020 09:40:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwbMbBbrKbqysaF/e8HNfQqxAmqQ8V/Qa2Y892CZ07aSvKGhcSJycELHIVAgSMvPcp5WMt5 X-Received: by 2002:a17:906:e08f:: with SMTP id gh15mr3498650ejb.443.1601052044742; Fri, 25 Sep 2020 09:40:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601052044; cv=none; d=google.com; s=arc-20160816; b=T1Rt/FdoWHfhLBCOWlt8IOKrJQWSClOr7J28QkuMgEomql/4l1yTeV+UmAr9BfAEDX 30sQj1MKwLj9PayNDvUZ21g4GpxSQY30131ATgaDxtjfEQYYggE8vMWbJ6F6Rhxvbug3 EtKVLQNSolT2O1H4H5tlncL6yN10MWcTGpa6MhI7E5rGy3E7fagQVmkrDIqbbR9j2blM H1N+sp5nOL/nUDm2ZgJCxy21LlZYWPNCl2f0WiIde5ydVTBD3T7u67ADvMUwttsdxIML fyB5+0hN3taivclpJ4/+EdnYM56xrlpvxa4YPK+R9nJadwCFdF8x5eaH1WKgLw7+VL9M NacQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=huhhpYFQZkddt/radLtgjMsLhiWVs7w1vEiI3gqnmaQ=; b=HmeQmJz2EXi5cQhclOSj5/23Q1JhW58sl5A5VmDeWw3as9EnyZmtm7jOY6XAnyN8tB w6f1DqO11o6c1QwIDQERKf0m4BFAz/7B0neub39YZjtOppfqTCqAwJzbUOXlRaRKU5s3 QhlDIkj3iAwa0m/+TJlsqtQQMhz8NflhJzY6ML00bVj5yb/ubI2krlLf+ul7Tq4YvCCK 4cRTIJdlkGO+RHs7FAWEeYlgIAIGaG9bOBQAjQQGuEWE0fcfKAhRZWoKKW+Oxsn4462v 2hLl6TDUV4ZlM4sUx/PzMaLDcoB+I60UUjgZEPbgOM4wpUqMJc5KJwi1CylunHN6RhAg VeIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=WXZNV2sU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id u22si2114886edy.599.2020.09.25.09.40.21; Fri, 25 Sep 2020 09:40:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=WXZNV2sU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1728861AbgIYQiV (ORCPT + 99 others); Fri, 25 Sep 2020 12:38:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:35548 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728069AbgIYQiV (ORCPT ); Fri, 25 Sep 2020 12:38:21 -0400 Received: from gmail.com (unknown [104.132.1.76]) (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 C4E52206BE; Fri, 25 Sep 2020 16:38:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601051901; bh=QGgqzYHKwLhU8qGchhG95ocnro20Uloj/gEjGanOpKI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=WXZNV2sUi/3rDC09k4sGxhoTano9Jr5dbiDuP626WoskNDGjMd0MRTKAnMKx4XQxz nIHpWb7E/D/qUUuw2r65VKRu9FEMgK2yAyy47ShyMUlLxmwtDf7Si917sgWXqYImby QLuYCTdxfodQirmxcyN15uEStZSRHx5K10lZ3IMk= Date: Fri, 25 Sep 2020 09:38:19 -0700 From: Eric Biggers To: Chao Yu Cc: syzbot , chao@kernel.org, glider@google.com, jaegeuk@kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com Subject: Re: [f2fs-dev] KMSAN: uninit-value in f2fs_lookup Message-ID: <20200925163819.GA3315208@gmail.com> References: <000000000000f9f80905b01c7185@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 25, 2020 at 05:06:33PM +0800, Chao Yu wrote: > Hi, > > I don't see any problem here, thanks for your report. :) > > Thanks, What about if max_depth == 0 in __f2fs_find_entry()? Then __f2fs_find_entry() would return NULL without initializing *res_page. A fix could be: diff --git a/fs/f2fs/dir.c b/fs/f2fs/dir.c index 069f498af1e3..ceb4431b5669 100644 --- a/fs/f2fs/dir.c +++ b/fs/f2fs/dir.c @@ -357,16 +357,15 @@ struct f2fs_dir_entry *__f2fs_find_entry(struct inode *dir, unsigned int max_depth; unsigned int level; + *res_page = NULL; + if (f2fs_has_inline_dentry(dir)) { - *res_page = NULL; de = f2fs_find_in_inline_dir(dir, fname, res_page); goto out; } - if (npages == 0) { - *res_page = NULL; + if (npages == 0) goto out; - } max_depth = F2FS_I(dir)->i_current_depth; if (unlikely(max_depth > MAX_DIR_HASH_DEPTH)) { @@ -377,7 +376,6 @@ struct f2fs_dir_entry *__f2fs_find_entry(struct inode *dir, } for (level = 0; level < max_depth; level++) { - *res_page = NULL; de = find_in_level(dir, level, fname, res_page); if (de || IS_ERR(*res_page)) break;