Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2408946yba; Mon, 15 Apr 2019 11:00:07 -0700 (PDT) X-Google-Smtp-Source: APXvYqwGiFEmtsq/AErE1Mpt/x9JK0WB5HD01stDSjPi4MujYvJL9BG5MqQuQ9wv1O3T619bpvV8 X-Received: by 2002:a65:47c6:: with SMTP id f6mr71170071pgs.173.1555351207698; Mon, 15 Apr 2019 11:00:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555351207; cv=none; d=google.com; s=arc-20160816; b=AQQmY3LHKBCd0i6+2kxLPmmUl41iUutPOAW36Sxg9MFFcJoC/Yy+1mxpES93zYucWx V0qzs2C/tZ5Udth6gFOxZen1aaa9lKCb0wQt+d7LRHjaLNnsifvYnMJxGg3B2LBZFBrd ibhLN0nRjtz63dlKm1ePPrp7deIsvKqPA/WSBs3TgEXr5Gnd19B7jCnWUhOKMoMVVumM GrAZxTZFOtiZKnuEANkFyu4Wk9nzkRuGpaF+VYJs6Zj0xnoDwqd80zns01EMlmyUVSv6 UMekfJiNBeTMbPJHdhM+FawrrRAbQ3yKTHNtAGf7di7cbagEpc/1v3euYLiga7tbLI+D PgrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=Kt3m9rcOnI6J+zVNa8o9f3p6anA0asulS92IkzcZMJ8=; b=qTMY9r+PsEcp32om4h+kUtvKL9QovoplUuO5R5hHL5P3g1TJHIvzE6okKsMXur7Ows rct7hT2q3VpnNwlwaA95o7fkZ5VV2j8YCkqEBTeQLkunW1//fz5U86PIo+C9PmZk+y/u TQFJUReN65IXPgCK9Fbooa4vlVwOxqo6p+sgAe++aLpsbHvAlxgVQ7iFYmkFQoJI36R9 H0aMGfvnivuQuPFaco1W6LoNxs7DhcZRXHzf98qHn1BNg03UulQWBOoBmsXjWIQj/ohE wRKYtfc1I1KdQgKNqFWq7HIJknHuaI7gfzEUTFx0OVH3hjZRi6pMniSE1Y0BPAbb3Swp mmng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@umn.edu header.s=google header.b=ZF9Xg2yO; 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=umn.edu Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w4si44205113pgr.253.2019.04.15.10.59.51; Mon, 15 Apr 2019 11:00:07 -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=@umn.edu header.s=google header.b=ZF9Xg2yO; 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=umn.edu Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727720AbfDOR6Q (ORCPT + 99 others); Mon, 15 Apr 2019 13:58:16 -0400 Received: from mta-p5.oit.umn.edu ([134.84.196.205]:35882 "EHLO mta-p5.oit.umn.edu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726740AbfDOR6P (ORCPT ); Mon, 15 Apr 2019 13:58:15 -0400 Received: from localhost (unknown [127.0.0.1]) by mta-p5.oit.umn.edu (Postfix) with ESMTP id 817A07A1 for ; Mon, 15 Apr 2019 17:58:14 +0000 (UTC) X-Virus-Scanned: amavisd-new at umn.edu Received: from mta-p5.oit.umn.edu ([127.0.0.1]) by localhost (mta-p5.oit.umn.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id NgyflQKhCP59 for ; Mon, 15 Apr 2019 12:58:14 -0500 (CDT) Received: from mail-it1-f198.google.com (mail-it1-f198.google.com [209.85.166.198]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mta-p5.oit.umn.edu (Postfix) with ESMTPS id 52726909 for ; Mon, 15 Apr 2019 12:58:14 -0500 (CDT) Received: by mail-it1-f198.google.com with SMTP id z125so16444821itf.4 for ; Mon, 15 Apr 2019 10:58:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=umn.edu; s=google; h=from:to:cc:subject:date:message-id; bh=Kt3m9rcOnI6J+zVNa8o9f3p6anA0asulS92IkzcZMJ8=; b=ZF9Xg2yOU4mtnvmYyTIPdVITfDREnLt9YMSui3YaS+Mykb2Q6nRaVpWzJoLAkTi3VK gqWwOSzzw3wekTFFIyNNXEV2/c8rxmAy3gCJsyjkziXgpVniIqX/tO1sFBauNcKNuq9q woIPwFXJj0lqQyBnJoey1vmihHJU/J4wOE/0BvpIeYumfDyKlhUmH91J9n+NwIowxtvd DOq3tc8OHt+ObCv7+dyHEgdO7XJ5aT2vJgTBqQOKfK1vUYzmcag0yBey9amNd1pkQRVU dBIyvEHS/YdHy46RfLJGyLIM/GacX3PqNNNS0Lhxww3Q63y2j/tETD+cXvRALlqoDh8A NP/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=Kt3m9rcOnI6J+zVNa8o9f3p6anA0asulS92IkzcZMJ8=; b=bOfGSWqxyK3e1XhyebWLXXoLvMR4b24/OT82w7p4HvcER8tiOnjVIr8NPQP8UDaMfG x3S0DWtIoOuw0DLDaMjttf8cpXt/SYXg0SL2955b0xjysW6hynknoSRtitJK0bip8kkB M+6FgCJb9ff4fvDxw4UCeqtof1HRtiYGSQ8P90cDwGHd8gDZvyrtw3DLndKfqctWfTM8 RUxOJJq9vYJFGeN2ZggTLfjD0MSX+nUjVO/OSj5VoS1nQ8zIB6T12gOQfVtfsseuDhtv qHx7A5Mbkne6/pmK/35CiU/QPQPpfZMVS/rYyIamZzrrm7yv6LvHhT11f/AuO1YsyvkQ VT9w== X-Gm-Message-State: APjAAAX6dbIg0hDufzrWe+Bcq/ce0GnkzsqIZa24SmIkfsRaGCpwAibd fZja8HRX7PVvUc5mlpx21xy9T7Ea+4kZe0uDAYDrosHJ8cMuyCWw18HPB3s9y5sSeOibglb4pk6 DT/Xei/1nTru962AvrlDeqdYSiw5t X-Received: by 2002:a24:7388:: with SMTP id y130mr27117488itb.85.1555351094019; Mon, 15 Apr 2019 10:58:14 -0700 (PDT) X-Received: by 2002:a24:7388:: with SMTP id y130mr27117477itb.85.1555351093851; Mon, 15 Apr 2019 10:58:13 -0700 (PDT) Received: from cs-u-cslp16.dtc.umn.edu (cs-u-cslp16.cs.umn.edu. [128.101.106.40]) by smtp.gmail.com with ESMTPSA id e11sm17761140iog.79.2019.04.15.10.58.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 15 Apr 2019 10:58:13 -0700 (PDT) From: Wenwen Wang To: Wenwen Wang Cc: Jan Kara , linux-kernel@vger.kernel.org (open list) Subject: [PATCH v2] udf: fix an uninitialized read bug and remove dead code Date: Mon, 15 Apr 2019 12:58:06 -0500 Message-Id: <1555351086-3935-1-git-send-email-wang6495@umn.edu> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. To fix this issue, this patch drops the whole code in the ifdef 'UDF_RECOVERY' region, as it is dead code. Signed-off-by: Wenwen Wang --- fs/udf/namei.c | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/fs/udf/namei.c b/fs/udf/namei.c index 58cc241..77b6d89 100644 --- a/fs/udf/namei.c +++ b/fs/udf/namei.c @@ -304,21 +304,6 @@ static struct dentry *udf_lookup(struct inode *dir, struct dentry *dentry, if (dentry->d_name.len > UDF_NAME_LEN) return ERR_PTR(-ENAMETOOLONG); -#ifdef UDF_RECOVERY - /* temporary shorthand for specifying files by inode number */ - if (!strncmp(dentry->d_name.name, ".B=", 3)) { - struct kernel_lb_addr lb = { - .logicalBlockNum = 0, - .partitionReferenceNum = - simple_strtoul(dentry->d_name.name + 3, - NULL, 0), - }; - inode = udf_iget(dir->i_sb, lb); - if (IS_ERR(inode)) - return inode; - } else -#endif /* UDF_RECOVERY */ - fi = udf_find_entry(dir, &dentry->d_name, &fibh, &cfi); if (IS_ERR(fi)) return ERR_CAST(fi); -- 2.7.4