Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp690053rwb; Fri, 13 Jan 2023 03:03:32 -0800 (PST) X-Google-Smtp-Source: AMrXdXvCQ1MrIDa+88IlU2QaHXdxHaGiTTaTLiNvtXeh/5hCZIOkbwcVR0Y6mkaTCG9s1IMWXtmO X-Received: by 2002:a17:90b:1992:b0:229:25de:ee4a with SMTP id mv18-20020a17090b199200b0022925deee4amr2165007pjb.45.1673607812435; Fri, 13 Jan 2023 03:03:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673607812; cv=none; d=google.com; s=arc-20160816; b=mJJJDPn04bfMdQnxzZZNZGkShlJP+Iv52V7advhyKXjJTDl4t32tLpjhsiKOkaEuVK gs202xL8AsfswNRpjUaO7FSNmXkyFpLy2iTCZ3qSDrPF/u4U6UoJb3ESzWid89vXu+rC lLYNLrXzg9z2aShO4x7314BNJ2C59IrG2EU+h7VsZgnYnJnRt0OWKvIOkwLT2cAaLRou 5PQ5vVq7hlZvan3Lb4g54HOvb5vpZ0TPjjF2VdBUcjqNTcHHKCW1A7KkTet7FkBAwTvl f8WqHYTk8OpaphXdCgkBTMYm3nlHRyit1HxYeQsp2g8QXzLXENeSNdzgaDUalKwOTnLX GmRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature:dkim-signature; bh=Y9eT1AQ2nLSPlGy+01IEzMKkV5ZBkCn+StmV6WQ5bJs=; b=wTfAMtjlnvpTTMa/q/ghQwJmM98vrUZUt7Qk3Zr2XJigHJqS1XIfSe6Q/o0jERfjcj D3KGHQbuDU0mzxgYuJcayZ0ZANpuBBStrU1605SNAvvZHHIR2xtEsolovnyGzW0uiV+v 7fFOs/S5bPC4sFIVpLwRP0OKaE7ynG5z4ZT5Vto2v/Z11K1B1naj60kbYbi6ciykFazb KNT0WqzEuBiqYm00oZk28S1OB8eVLV9gxrjczv4C6oQ9LkEtXMQ6/SAN/mCQf0b5bOum TrlJJm+rwG3MyXTExPJ1WrY5HDRn3duK8YNDg0FyyxeEZSvGwHwxOx3JGw71E+FZarIL qgQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@paragon-software.com header.s=mail header.b=HATPBCey; dkim=pass header.i=@paragon-software.com header.s=mail header.b=K+qGQ9fT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=paragon-software.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id pg7-20020a17090b1e0700b0021929c63260si22167164pjb.8.2023.01.13.03.03.24; Fri, 13 Jan 2023 03:03:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@paragon-software.com header.s=mail header.b=HATPBCey; dkim=pass header.i=@paragon-software.com header.s=mail header.b=K+qGQ9fT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=paragon-software.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233202AbjAMKGD (ORCPT + 51 others); Fri, 13 Jan 2023 05:06:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235485AbjAMKGB (ORCPT ); Fri, 13 Jan 2023 05:06:01 -0500 Received: from relayaws-01.paragon-software.com (relayaws-01.paragon-software.com [35.157.23.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EFFEF1BEA8 for ; Fri, 13 Jan 2023 02:05:59 -0800 (PST) Received: from relayfre-01.paragon-software.com (unknown [172.30.72.12]) by relayaws-01.paragon-software.com (Postfix) with ESMTPS id 5C7601D37; Fri, 13 Jan 2023 10:02:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1673604133; bh=Y9eT1AQ2nLSPlGy+01IEzMKkV5ZBkCn+StmV6WQ5bJs=; h=Date:Subject:To:CC:References:From:In-Reply-To; b=HATPBCey0/6YxPidpPlhO/bFDFl7FuKwFf92FGuRCXyqf+MSI+9Zx1T5ilAsFacn1 K0yuiCcXLyxLOayR2lXITszLscStJdZavqcgFpBUG7Z0JY/x/4fIs1dyP04ZU0ncGq dz+QCo2qC8ccBh4qraOIKo4cKjSJVl2JcH6mcPQ8= Received: from dlg2.mail.paragon-software.com (vdlg-exch-02.paragon-software.com [172.30.1.105]) by relayfre-01.paragon-software.com (Postfix) with ESMTPS id E11751FE3; Fri, 13 Jan 2023 10:05:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1673604357; bh=Y9eT1AQ2nLSPlGy+01IEzMKkV5ZBkCn+StmV6WQ5bJs=; h=Date:Subject:To:CC:References:From:In-Reply-To; b=K+qGQ9fT1B4bvGHxpbmUNCi6w++3rIjzcg6iJu1+SgpWk62n/xVgvUJ9ycabhEgQn /jA4W7WkaLNJ25SYrWcOXdGhwxT1pQNPborz1cGw6lFvbfyAL8BY9sHoPRbTy5+346 nLo2A0VW010U5rXluQfCxcxdypd3rj9EbWqzwt+M= Received: from [192.168.211.54] (192.168.211.54) by vdlg-exch-02.paragon-software.com (172.30.1.105) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.7; Fri, 13 Jan 2023 13:05:57 +0300 Message-ID: <808288ae-bf1a-ccc6-ab37-d1b2022b44b5@paragon-software.com> Date: Fri, 13 Jan 2023 14:05:56 +0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0 Subject: Re: [PATCH -next] fs/ntfs3: Fix potential NULL/IS_ERR bug in ntfs_lookup() Content-Language: en-US To: Peng Zhang , , CC: , , , , Dan Carpenter References: <20230112013248.2464556-1-zhangpeng362@huawei.com> From: Konstantin Komarov In-Reply-To: <20230112013248.2464556-1-zhangpeng362@huawei.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [192.168.211.54] X-ClientProxiedBy: vdlg-exch-02.paragon-software.com (172.30.1.105) To vdlg-exch-02.paragon-software.com (172.30.1.105) X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12.01.2023 05:32, Peng Zhang wrote: > From: ZhangPeng > > Dan Carpenter reported a Smatch static checker warning: > > fs/ntfs3/namei.c:96 ntfs_lookup() > error: potential NULL/IS_ERR bug 'inode' > It will cause null-ptr-deref when dir_search_u() returns NULL if the > file is not found. > Fix this by replacing IS_ERR() with IS_ERR_OR_NULL() to add a check for > NULL. > > Fixes: fb6b59b5a2d6 ("fs/ntfs3: Fix null-ptr-deref on inode->i_op in ntfs_lookup()") > Reported-by: Dan Carpenter > Signed-off-by: ZhangPeng > --- > fs/ntfs3/namei.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/fs/ntfs3/namei.c b/fs/ntfs3/namei.c > index 3db34d5c03dc..f23c2c26dd08 100644 > --- a/fs/ntfs3/namei.c > +++ b/fs/ntfs3/namei.c > @@ -93,7 +93,7 @@ static struct dentry *ntfs_lookup(struct inode *dir, struct dentry *dentry, > * If the MFT record of ntfs inode is not a base record, inode->i_op can be NULL. > * This causes null pointer dereference in d_splice_alias(). > */ > - if (!IS_ERR(inode) && inode->i_op == NULL) { > + if (!IS_ERR_OR_NULL(inode) && inode->i_op == NULL) { > iput(inode); > inode = ERR_PTR(-EINVAL); > } Hello. We have added a patch with this check just before the New Year. (here https://lore.kernel.org/lkml/ee705b24-865b-26ff-157d-4cb2a303a962@paragon-software.com/) Thank you for your attention!