From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from relayaws-01.paragon-software.com (relayaws-01.paragon-software.com [35.157.23.187]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A3B53282F3C for ; Tue, 7 Apr 2026 17:23:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=35.157.23.187 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775582598; cv=none; b=lDnt5d4U9g9J2hpMhzQxaxnK90vb2N/1WOcTunjPe71LRvGwgdF6HJShaYFHhgzQ36xtyurZlaKtdIFoI6CKOX2GSndR5ca/DLvE5BCFLZidKDCrS5C2HSe4tMuUy3BwaxVSFDH+4r9q5deF06+uYflKHPHRVFBmIpwusDv6ftc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775582598; c=relaxed/simple; bh=T49+l/7DF7jdB5D8cFN45E844gpxRHEz48XYLTEj8fE=; h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From: In-Reply-To:Content-Type; b=QzwdMkHJD99A+fss2l5zzpOsSsjjh0vxNNI/VCxHvEgtbWGT2YDLyW9Q2iaLkowvh6gcgjgWE12Ulgybcoxs+EI9HiQpcmfKmrOb8/4ltxN0+265vBBJoQ8hZOOuvY/lXLaSF4xOQ2NuNiC7bIE3vuN74oLJ5ULYR7L3rGypOMM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=paragon-software.com; spf=pass smtp.mailfrom=paragon-software.com; dkim=pass (1024-bit key) header.d=paragon-software.com header.i=@paragon-software.com header.b=fU8NGKXe; arc=none smtp.client-ip=35.157.23.187 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=paragon-software.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=paragon-software.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=paragon-software.com header.i=@paragon-software.com header.b="fU8NGKXe" Received: from relayfre-01.paragon-software.com (relayfre-01.paragon-software.com [176.12.100.13]) by relayaws-01.paragon-software.com (Postfix) with ESMTPS id 07FF61D43; Tue, 7 Apr 2026 17:23:28 +0000 (UTC) Authentication-Results: relayaws-01.paragon-software.com; dkim=pass (1024-bit key; unprotected) header.d=paragon-software.com header.i=@paragon-software.com header.b=fU8NGKXe; dkim-atps=neutral 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 AB37D244; Tue, 7 Apr 2026 17:23:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1775582595; bh=PzyvpGsXxkoBhRB/ZlSuqkPyxBrxKQVcQEdlbFh0XBk=; h=Date:Subject:To:CC:References:From:In-Reply-To; b=fU8NGKXem2mJ3OvlYNGUlLR7NZf8StBk2z2QTIkfzJxtvZlkqTIn+Oh71O1acjCCo hYAHQycaLSdocOwCiKdPVaT3MX7/VUbhaOu5Vx0dPPD5AZ6WG/cuPVhK0+otUYArRu ROHBhmY4btgIFP+sA853llzdJrCZ52FwpxUTGO+A= Received: from [192.168.95.128] (172.30.20.204) 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; Tue, 7 Apr 2026 20:23:14 +0300 Message-ID: Date: Tue, 7 Apr 2026 19:23:13 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] fs/ntfs3: fix potential double iput on d_make_root() failure To: Zhan Xusheng CC: , Zhan Xusheng References: <20260326091232.92760-1-zhanxusheng@xiaomi.com> Content-Language: en-US From: Konstantin Komarov In-Reply-To: <20260326091232.92760-1-zhanxusheng@xiaomi.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: vdlg-exch-02.paragon-software.com (172.30.1.105) To vdlg-exch-02.paragon-software.com (172.30.1.105) On 3/26/26 10:12, Zhan Xusheng wrote: > [You don't often get email from zhanxusheng1024@gmail.com. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ] > > d_make_root() consumes the reference to the passed inode: it either > attaches it to the newly created dentry on success, or drops it via > iput() on failure. > > In the error path, the code currently does: > sb->s_root = d_make_root(inode); > if (!sb->s_root) > goto put_inode_out; > > which leads to a second iput(inode) in put_inode_out. This results in > a double iput and may trigger a use-after-free if the inode gets freed > after the first iput(). > > Fix this by jumping directly to the common cleanup path, avoiding the > extra iput(inode). > > Signed-off-by: Zhan Xusheng > --- > fs/ntfs3/super.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c > index 174a7cb202a0..d0dad15076ca 100644 > --- a/fs/ntfs3/super.c > +++ b/fs/ntfs3/super.c > @@ -1673,7 +1673,7 @@ static int ntfs_fill_super(struct super_block *sb, struct fs_context *fc) > sb->s_root = d_make_root(inode); > if (!sb->s_root) { > err = -ENOMEM; > - goto put_inode_out; > + goto out; > } > > if (boot2) { > -- > 2.43.0 > Hello, Thanks for the patch. It was applied. I'm going to take a closer look at this problem. Regards, Konstantin