Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp3943185rwb; Fri, 30 Sep 2022 10:21:32 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6QKdLWpPxKLN6q+3pofWBCZSBNR0PU2NzqkU/1EhTiDWJAUTvNndwuWXC32Z5F2b2nJR6y X-Received: by 2002:a17:906:99c4:b0:787:dc72:6311 with SMTP id s4-20020a17090699c400b00787dc726311mr5791575ejn.254.1664558491834; Fri, 30 Sep 2022 10:21:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664558491; cv=none; d=google.com; s=arc-20160816; b=ANZBiXc0xmgh+SavBEo9Rp8LS7x/2jL4h2tQ4eFF50pzm0q9pEUvq5c2zKab345VD7 Yd71Bll4pDAuqOrmKV4V0ruTwdHCSp7iX3c/z8crw4cKOOszqdokcBNjTh4j7Hyfiyus zQ2LdfkB8fsfAGzffm1mQUNV82DdPIvDoTciMNfKv07KbtPpvZawdGuAoVOJ7a2exqpK RCfmrNkIbxkL4PxkWldG2br2825CdXyetxTgCfqKqnHCMlnHuRfupe//EXd4p1pyoAnq JBfIrN2n/Z8fl2aLE9TFPL1SjfOXgtHvJ/2AlgwoLtnukWF5cIvUq+2h2a6R+JbCLYtz zH1A== 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=J+wfgllXwhLlahIGgqIBX6suMZ9PoYV9QymXeIuNwCc=; b=AyIvdD/ZUlPbLi+nnt/r6EAE6Fq5/IRvuLy5xyVZ7meAbsYFFhFEphoJReM4DnAo6J 08BQeqfine30HYjSr/oUivExY0+HCLzq0fFqw9lK0QWNGbbgCGZSzLWRFH4ggdVxUHL8 y73kSbCMjd49poXJDvNdEjZtr/IYzEvTE66k2KmasjRwkH2z++p3P7v6z9tUHr4JZbGn 8yHwAKUBxuVTfqACf1Gx4zgLtTdJJXEOuT2FltDmf+/Glg7giMuY/xrQh1WExzhrT13g ld1NjijSPV7s9Xrs6yHfG7gz+KbWaQL9aqF2qXbnZoWxnlq/0+UZM0Bm29DQRyN1GTvI I4OA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@paragon-software.com header.s=mail header.b=bNdPIHua; dkim=pass header.i=@paragon-software.com header.s=mail header.b=Ux6Q0Z9P; 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 o1-20020a509b01000000b00457cc36dfe3si2291429edi.159.2022.09.30.10.20.40; Fri, 30 Sep 2022 10:21:31 -0700 (PDT) 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=bNdPIHua; dkim=pass header.i=@paragon-software.com header.s=mail header.b=Ux6Q0Z9P; 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 S229646AbiI3QV4 (ORCPT + 99 others); Fri, 30 Sep 2022 12:21:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231680AbiI3QVy (ORCPT ); Fri, 30 Sep 2022 12:21:54 -0400 Received: from relayaws-01.paragon-software.com (relayaws-01.paragon-software.com [35.157.23.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5000A2B61C for ; Fri, 30 Sep 2022 09:21:53 -0700 (PDT) Received: from relayfre-01.paragon-software.com (unknown [172.30.72.12]) by relayaws-01.paragon-software.com (Postfix) with ESMTPS id 339611D0C; Fri, 30 Sep 2022 16:19:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1664554776; bh=J+wfgllXwhLlahIGgqIBX6suMZ9PoYV9QymXeIuNwCc=; h=Date:Subject:To:CC:References:From:In-Reply-To; b=bNdPIHuapMl8Koo/PjBaYPQsAzsMr6saaO3CGJ5rIunkK1GpDENWC7JMMnJKngm7u mKcbVIu/Ky7WWweEWCpDT0ziFVXpTTYveDw3qlfW09CDp2PbGsslDqYIlwB1jDeL/D mAIg0kgRsB7rS7+dVSZ6fwtD8q68rQmcZluRFurc= 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 43A161E81; Fri, 30 Sep 2022 16:21:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1664554911; bh=J+wfgllXwhLlahIGgqIBX6suMZ9PoYV9QymXeIuNwCc=; h=Date:Subject:To:CC:References:From:In-Reply-To; b=Ux6Q0Z9Px7xpCRJV5iyUCUxcTIEmVXbWJLM9Tr+SN5unkJbSR+5khsfttRre6sTYQ dQkBD+3fEVkwYWWfl/55qxa+cM3HXyz4vqDT0GR9mI7mRmSvAUsJK+1DSXuc8ZkmNe 0DKnKFcBvDBe0zAy9SJ1LZ7M5j2bNU7Ja9L5lOLo= Received: from [172.30.8.65] (172.30.8.65) 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, 30 Sep 2022 19:21:50 +0300 Message-ID: <6bb11497-c6bd-41ea-409a-fbddcf75ea97@paragon-software.com> Date: Fri, 30 Sep 2022 19:21:49 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH] fs/ntfs3: fix memory leak in put_ntfs() Content-Language: en-US To: Karthik Alapati , Nathan Chancellor , Nick Desaulniers , Tom Rix CC: , , References: From: Konstantin Komarov In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [172.30.8.65] X-ClientProxiedBy: vobn-exch-01.paragon-software.com (172.30.72.13) To vdlg-exch-02.paragon-software.com (172.30.1.105) X-Spam-Status: No, score=-2.7 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 8/31/22 07:34, Karthik Alapati wrote: > free options in put_ntfs() rather than in ntfs_put_super() > > BUG: memory leak > unreferenced object 0xffff8881104f3720 (size 32): > comm "syz-executor634", pid 3605, jiffies 4294945517 (age 12.630s) > hex dump (first 32 bytes): > e0 36 4f 10 81 88 ff ff 80 57 e1 85 ff ff ff ff .6O......W...... > 00 00 00 00 00 00 00 00 c0 ff c0 ff 00 00 00 00 ................ > backtrace: > [] kmalloc include/linux/slab.h:600 [inline] > [] kzalloc include/linux/slab.h:733 [inline] > [] ntfs_init_fs_context+0x22/0x1e0 fs/ntfs3/super.c:1397 > [] alloc_fs_context+0x225/0x3b0 fs/fs_context.c:290 > [] do_new_mount fs/namespace.c:3025 [inline] > [] path_mount+0x6f3/0x10d0 fs/namespace.c:3370 > [] do_mount fs/namespace.c:3383 [inline] > [] __do_sys_mount fs/namespace.c:3591 [inline] > [] __se_sys_mount fs/namespace.c:3568 [inline] > [] __x64_sys_mount+0x18e/0x1d0 fs/namespace.c:3568 > [] do_syscall_x64 arch/x86/entry/common.c:50 [inline] > [] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 > [] entry_SYSCALL_64_after_hwframe+0x63/0xcd > > BUG: memory leak > unreferenced object 0xffff8881104f36e0 (size 32): > comm "syz-executor634", pid 3605, jiffies 4294945517 (age 12.630s) > hex dump (first 32 bytes): > 6d 61 63 63 79 72 69 6c 6c 69 63 00 00 00 00 00 maccyrillic..... > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ > backtrace: > [] kmemdup_nul+0x2d/0x70 mm/util.c:152 > [] vfs_parse_fs_string+0x6e/0xd0 fs/fs_context.c:178 > [] generic_parse_monolithic+0xe0/0x130 fs/fs_context.c:224 > [] do_new_mount fs/namespace.c:3036 [inline] > [] path_mount+0xb94/0x10d0 fs/namespace.c:3370 > [] do_mount fs/namespace.c:3383 [inline] > [] __do_sys_mount fs/namespace.c:3591 [inline] > [] __se_sys_mount fs/namespace.c:3568 [inline] > [] __x64_sys_mount+0x18e/0x1d0 fs/namespace.c:3568 > [] do_syscall_x64 arch/x86/entry/common.c:50 [inline] > [] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 > [] entry_SYSCALL_64_after_hwframe+0x63/0xcd > > Link: https://syzkaller.appspot.com/bug?id=332ba47915d0e39e94b42a622f195f0804ecb67f > Reported-by: syzbot+9d67170b20e8f94351c8@syzkaller.appspotmail.com > Signed-off-by: Karthik Alapati > --- > 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 47012c9bf505..ffb76a5bfd4f 100644 > --- a/fs/ntfs3/super.c > +++ b/fs/ntfs3/super.c > @@ -439,6 +439,7 @@ static void init_once(void *foo) > */ > static noinline void put_ntfs(struct ntfs_sb_info *sbi) > { > + put_mount_options(sbi->options); > kfree(sbi->new_rec); > kvfree(ntfs_put_shared(sbi->upcase)); > kfree(sbi->def_table); > @@ -482,7 +483,6 @@ static void ntfs_put_super(struct super_block *sb) > /* Mark rw ntfs as clear, if possible. */ > ntfs_set_state(sbi, NTFS_DIRTY_CLEAR); > > - put_mount_options(sbi->options); > put_ntfs(sbi); > sb->s_fs_info = NULL; > Hello This patch failed our tests and caused email from kernel test robot, so I can't accept it. But the memory leak is a concern, thanks for the report.