Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp619084rwb; Fri, 13 Jan 2023 01:59:34 -0800 (PST) X-Google-Smtp-Source: AMrXdXvtn34IKOVC+QkIF/CaMZO6SDJrWr66r7sTBBb7R8gybB1MZgcNRPO7Fm8kjHlC8rI96e1K X-Received: by 2002:a17:90b:35c8:b0:226:b78b:a9c2 with SMTP id nb8-20020a17090b35c800b00226b78ba9c2mr32170290pjb.35.1673603973913; Fri, 13 Jan 2023 01:59:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673603973; cv=none; d=google.com; s=arc-20160816; b=b9huT7Nb6wYYwsnJCSXdj24OxhdgRmPibC9ICYOqYouMYbTLAokBRJxOKYbeP+rOS+ Uc7Mn20mb+UUNw8m9+rFmozA1fLiWnOObcmKkmShH0g2V75H16ft253HaceiRoJsiTnk JoEXmCoLieSFnIBIDHw1N80JvKNV1+OmH6bsEChOyq/E5YbJPs7zIzhoBZhUf9OiCdh0 4HnbwrhXF3jbYwuSOOhs+JvIvkpvzqUg38qobJaDI09yaJ/+tHOZyDLFGXW7UvSQdTOj aoLRrzuxts3AtOwoA1ft/OIUjMZF/v/2Vz0X+bCquEPceY1BAaDc6qI/O/KChh1aN+zH gpNA== 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=hkS2VR9GGBUmCFjS1zTFPOZAx3NuHCndXgPxoK8gzuM=; b=Qmf+wkBnwhXm3sjIPnNHINrWdOJQ01DfZk4qmocRLwSQKYF+N1tcMc4jzhfY2Ag+zW AQgcwOkzEoYmVG2CGenhsj3IEu8jRRz9a1nIelNa02tJcF8vQRD69xlYx+dZ3Ok41LrQ cRFdAgS/uusOSd51cFh3iddvAuqrnaEI++aF+NB1Z9iOrwA/hpfjMh1F0aXfV/7Z+TIQ DVKsKaED3nqEDVEuvvegCeXapPrjE0h6b5L+CtnsWw22ApSO9P+ho6IJ8fxhifkVhfhB TLL9ShHidPRFiCyUShFQOPEYHbwfsqQLKUTgdScuUHpEklxWdP7+BoiVNMEpTg+9nPoN pgUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@paragon-software.com header.s=mail header.b=A0o1lj4F; dkim=pass header.i=@paragon-software.com header.s=mail header.b=n8+8xItr; 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 mq2-20020a17090b380200b0022387a1f9a5si22462779pjb.134.2023.01.13.01.59.27; Fri, 13 Jan 2023 01:59:33 -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=A0o1lj4F; dkim=pass header.i=@paragon-software.com header.s=mail header.b=n8+8xItr; 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 S240603AbjAMJwJ (ORCPT + 51 others); Fri, 13 Jan 2023 04:52:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231327AbjAMJvm (ORCPT ); Fri, 13 Jan 2023 04:51:42 -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 0E1821A051 for ; Fri, 13 Jan 2023 01:44:50 -0800 (PST) Received: from relayfre-01.paragon-software.com (unknown [172.30.72.12]) by relayaws-01.paragon-software.com (Postfix) with ESMTPS id 957BA1D37; Fri, 13 Jan 2023 09:41:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1673602864; bh=hkS2VR9GGBUmCFjS1zTFPOZAx3NuHCndXgPxoK8gzuM=; h=Date:Subject:To:CC:References:From:In-Reply-To; b=A0o1lj4FHUKimBODbEWE63pnGGlfogAKtMclPQ361LC3NrVG56WEScgt/umNwpwQ/ m21pn3bCGtCNcewJCyhSTLAei2dnV8oQS3X6EreAA1fQa5Goilnv4foHBXdjzLalf5 XehEiv7tEbl9IVMoF2FPuFxjebIYismfIyw/QT3I= 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 239C52181; Fri, 13 Jan 2023 09:44:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1673603089; bh=hkS2VR9GGBUmCFjS1zTFPOZAx3NuHCndXgPxoK8gzuM=; h=Date:Subject:To:CC:References:From:In-Reply-To; b=n8+8xItrHdhUuoWTPLkgT1eonBcBf6Ms+zilmhFcJRjOLRFfNLu68ZZzWkiRj42lE 5KhE2aSByu6WiWb8TdTYn7gceB7xhE4qQs+oe0t5BRZjOmCKoZaO1FuukS/qGeMKsJ pO2Lesc9lHTeLbjJaPbHObvfgpTjhATFdWJj17TY= 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 12:44:48 +0300 Message-ID: <2f653f1c-161c-57d2-b3c7-f21ded261938@paragon-software.com> Date: Fri, 13 Jan 2023 13:44:48 +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] fs/ntfs3: Fix error handling in ntfs_new_inode() Content-Language: en-US To: Shigeru Yoshida CC: , References: <20230104123902.978084-1-syoshida@redhat.com> From: Konstantin Komarov In-Reply-To: <20230104123902.978084-1-syoshida@redhat.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 04.01.2023 16:39, Shigeru Yoshida wrote: > When memory allocation for mi->mrec fails, ntfs_new_inode() calls > iput(). iput() calls ni_write_inode() indirectly, it references > uninitialized mi->mrec, and this causes the kernel crash. This patch > fixes the issue by making the inode bad before calling iput(). > > Signed-off-by: Shigeru Yoshida > --- > fs/ntfs3/fsntfs.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/fs/ntfs3/fsntfs.c b/fs/ntfs3/fsntfs.c > index 567563771bf8..7b93f2aeb6f6 100644 > --- a/fs/ntfs3/fsntfs.c > +++ b/fs/ntfs3/fsntfs.c > @@ -1683,6 +1683,7 @@ struct ntfs_inode *ntfs_new_inode(struct ntfs_sb_info *sbi, CLST rno, bool dir) > > out: > if (err) { > + _ntfs_bad_inode(inode); > iput(inode); > ni = ERR_PTR(err); > } Hello. This bug have been already fixed by Ye Bin (https://lore.kernel.org/lkml/20221117091912.3436127-1-yebin@huaweicloud.com/). * Thanks for your work.