Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2313781yba; Mon, 15 Apr 2019 09:06:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqzJzAshiS9Ye3WV6+A0B4fySp9Iy8/dXmth2zdK/xXx9wu//0uZvEpTTTjOYnZyLoQmKcP7 X-Received: by 2002:a62:415d:: with SMTP id o90mr76423973pfa.236.1555344412823; Mon, 15 Apr 2019 09:06:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555344412; cv=none; d=google.com; s=arc-20160816; b=Aa8sMSPHtuX0pqMQ5WC1bFDgaB/Ql21vfYl9wWdcUMh9Kom9FB7jAtBEwoejlJ2/vo wClgeAlwkzm/N3k1sq6sho/11XYHh4TVRARJkPfx1KMhabZL7Z+sBn3mr70tdbQjoNZT Gsrv2SS+8qaUUvHsgl0HRlRuUxsJVKQmgBvVZeHqUCD2vYgPJX/avJUVNS89Y2RR0faD I0cFhTOgfS9lCB0VJBDGWazMu+tS+KA/I9v/2OZvgrkTyZF2C0vXs1cBl1RxO7DGsOQ9 J3kuk5B5rmdnoAEOtNrHsiIh9/gRc73ka9KA1sz6TQxaDPofamcrTBjB6i0dIZ0ca+2W ffEg== 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; bh=K7UDb0Lrw1+8vIkQ1rvOjRwBiYmmJyCNbKoUF0/A42Y=; b=kUzWFIaC/13XuMwjcM/7Z5DyOEyeeYekBCWsTlhK/FB8vQvXYApQCjOFIM63D819/4 koadrjMgXpyYIbB+qg5uYUiRL2YlbLZQlL02g59Nct5FTOZRdVX7lWcT1Lt7TYL8OOSW HvyvDrpDpeT3/i1Vs/uUISij/PXCHqrrqYFxqxzrqyaK7mTrQR7zjoMp/26lLiRw6Vxl ZsaQJZJV4/MoDSwefH+v2iMYiaS3e6cGjL30+G8sHqNj6vckDeOSEeLmGSyCobWGzY+C D4HQvCFbUIqvSAy4UIHyA825YAsi3hTSAh5AcVokXib7hHXN1NB3Bud9bzf1F8sZ0tCb ESWw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a73si29843888pge.358.2019.04.15.09.06.36; Mon, 15 Apr 2019 09:06:52 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727812AbfDOQFV (ORCPT + 99 others); Mon, 15 Apr 2019 12:05:21 -0400 Received: from mx2.suse.de ([195.135.220.15]:45440 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727499AbfDOQFV (ORCPT ); Mon, 15 Apr 2019 12:05:21 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 4400DAF93; Mon, 15 Apr 2019 16:05:18 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id E0D321E09BA; Mon, 15 Apr 2019 18:05:17 +0200 (CEST) Date: Mon, 15 Apr 2019 18:05:17 +0200 From: Jan Kara To: Wenwen Wang Cc: Jan Kara , open list Subject: Re: [PATCH] udf: fix an uninitialized read bug Message-ID: <20190415160517.GH13684@quack2.suse.cz> References: <1555341984-3282-1-git-send-email-wang6495@umn.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1555341984-3282-1-git-send-email-wang6495@umn.edu> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon 15-04-19 10:26:24, Wenwen Wang wrote: > In udf_lookup(), the pointer 'fi' is a local variable initialized by the > return value of the function call udf_find_entry(). However, if the macro > 'UDF_RECOVERY' is defined, this variable will become uninitialized if the > else branch is not taken, which can potentially cause incorrect results in > the following execution. > > This patch simply initializes this local pointer to NULL. > > Signed-off-by: Wenwen Wang Thanks for the patch! A better fix is to drop the whole UDF_RECOVERY ifdef and what's in it. It is just dead code anyway. Honza > --- > fs/udf/namei.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/fs/udf/namei.c b/fs/udf/namei.c > index 58cc241..9d499e1 100644 > --- a/fs/udf/namei.c > +++ b/fs/udf/namei.c > @@ -299,7 +299,7 @@ static struct dentry *udf_lookup(struct inode *dir, struct dentry *dentry, > struct inode *inode = NULL; > struct fileIdentDesc cfi; > struct udf_fileident_bh fibh; > - struct fileIdentDesc *fi; > + struct fileIdentDesc *fi = NULL; > > if (dentry->d_name.len > UDF_NAME_LEN) > return ERR_PTR(-ENAMETOOLONG); > -- > 2.7.4 > > -- Jan Kara SUSE Labs, CR