Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp5883915rwb; Wed, 7 Sep 2022 09:16:55 -0700 (PDT) X-Google-Smtp-Source: AA6agR5PYZBQ9GcJ60ODjoJ2NS0RJTQgrTf9PQDUoiATXjwzvcBZi39PTaPpAvijuiRFDtLn0r4h X-Received: by 2002:a17:906:4fc9:b0:76e:d46e:4419 with SMTP id i9-20020a1709064fc900b0076ed46e4419mr2718710ejw.610.1662567414913; Wed, 07 Sep 2022 09:16:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662567414; cv=none; d=google.com; s=arc-20160816; b=PK1K3avAdKSxLtvj3FeEZHZ4Mo9yuxUoJijfZXhETHAFO8b4M4bJae0cAcLjo3nmCD OCErax7aCwNQb2zRa9nJqHA7vPu3En8TNIrBou14oyJOHdWaqGPZg07woacDUThRUGEv LYG8EaTR+WjjJiBrdmrEPKw2/DUnR3GZul6hDyY9xNMErSBx4lM5dYlWVRO0PS+YZAMD 5PYy6LtrxV+feWj3M97xJRsNm8Dp59LOL8o03+5Iht2DHEIm5IyYswlhHiBjwoQB479i PMwweZBCqbILTAtmqkOZ5uJfQ37WR/yzq72J1fp1mudCA7JjPyLnBziRlHHNNH4b0SpP Dc1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:from:subject:cc:to:message-id:date :dkim-signature; bh=h9pHqkBQHX8167MxA1KNcgyy5zsR5NBPOvaAz5NiOX4=; b=wqRHZKA/X73uaTgwAA1b1z+MtEzc0XM8U7HeaeW0qixx3XxT/yRZDTMxIAZc+yDRdg 8JJi1KRUni7AMWIazf71dDz67BD7IGYiRqp4Ygx2qtEsMBcKkghadp5a0FYZOxb06IYB SF9Od0cXbbvr3u/iUaU3glsFib3uWfPGDbp3b/btYAtr2EQSXsObi9idmH/oNmc+M+Kw jqbFGFDmg0z3TSNSI653BlIvjcBL7T5OQNKagGnNdVLPDB4bt7kpUGk6mnlZ+FK5BApf zktiVtr2UmyXWuLxADaIJ3jX3x+YT/JFYm5vAefh6l/X1wnk1YGTpv1VqAWDxuUypQBm 6YAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=dG2Z3Uiy; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q10-20020a170906388a00b007304faaafc0si10808982ejd.432.2022.09.07.09.16.30; Wed, 07 Sep 2022 09:16:54 -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=@redhat.com header.s=mimecast20190719 header.b=dG2Z3Uiy; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230121AbiIGQEC (ORCPT + 99 others); Wed, 7 Sep 2022 12:04:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48766 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230372AbiIGQDj (ORCPT ); Wed, 7 Sep 2022 12:03:39 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C67518E05 for ; Wed, 7 Sep 2022 09:02:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1662566499; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=h9pHqkBQHX8167MxA1KNcgyy5zsR5NBPOvaAz5NiOX4=; b=dG2Z3UiyITdw7HEoU0xA4KAx/Vg+ec7EAE6yokgkRADsKBhOjRAxdgs3fbVxXAAyYgzuHP pd9HWETYcLIZENhs+PykSNe3TkUA9AeMerNmas8Tjy1Jmjs+Mo4IXWRssaqA1QQhsTi1IQ ni159lEfUAU09vOaVZ/V5zk3AK3oh4I= Received: from mail-pf1-f198.google.com (mail-pf1-f198.google.com [209.85.210.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-350-OtG3oDeXMEKAZsg5lk1GwQ-1; Wed, 07 Sep 2022 12:01:37 -0400 X-MC-Unique: OtG3oDeXMEKAZsg5lk1GwQ-1 Received: by mail-pf1-f198.google.com with SMTP id f16-20020aa782d0000000b0053e242136bfso3078541pfn.0 for ; Wed, 07 Sep 2022 09:01:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to:from :subject:cc:to:message-id:date:x-gm-message-state:from:to:cc:subject :date; bh=h9pHqkBQHX8167MxA1KNcgyy5zsR5NBPOvaAz5NiOX4=; b=NZu56djyGd2ZXjlggD8bb48w+I0CFrzkFp+LJI2evpXp/flkqKcDB00uAb/CpD4UY9 2MWf/0ZB+eT29DGR9tGGQd+5bIB/+QJOWZnTxRTbiCbzd8DGH5k2b6D3wSH5pYm/wDLN C14rORARyDMIz6+eChiindCwkz0JiHHCdJM6btuCpWd/F7YynDmz31qjhkkAY8MLeViQ 1Jz/4VeoCrbvPDBUsqX9zuyrEXGz/8/cqjw988XwhQP6QAdaSyl9tCtCia7n8rFIHFDn zjYqgnikWWOvzMEuUXT55PkVV8MxDR6bPO3BC7LT6Cn2SmjgTXl5GWJYxilgCf11moKj jFYw== X-Gm-Message-State: ACgBeo0xmRXZ5c2SRu+feZ7Mn1OcqPfH2vy/yraP/vol3QF2ONhB7yOS /b4wAHb7dqPo02FNVoUSqyWTBbU2fKWac7mOndvD7VVdZ8ZbalyWILsBl8n8iX4TTFKzkiRbZRr sfigWioxkFaGBAkp8xu5bvh6K X-Received: by 2002:a63:de07:0:b0:434:d973:5dff with SMTP id f7-20020a63de07000000b00434d9735dffmr4035111pgg.44.1662566496668; Wed, 07 Sep 2022 09:01:36 -0700 (PDT) X-Received: by 2002:a63:de07:0:b0:434:d973:5dff with SMTP id f7-20020a63de07000000b00434d9735dffmr4035088pgg.44.1662566496417; Wed, 07 Sep 2022 09:01:36 -0700 (PDT) Received: from localhost ([240d:1a:c0d:9f00:4f2f:926a:23dd:8588]) by smtp.gmail.com with ESMTPSA id x17-20020a170902ec9100b001752cb111e0sm12706532plg.69.2022.09.07.09.01.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Sep 2022 09:01:36 -0700 (PDT) Date: Thu, 08 Sep 2022 01:01:32 +0900 (JST) Message-Id: <20220908.010132.1804908388305469820.syoshida@redhat.com> To: almaz.alexandrovich@paragon-software.com Cc: ntfs3@lists.linux.dev, linux-kernel@vger.kernel.org, syoshida@redhat.com, syzbot+9d67170b20e8f94351c8@syzkaller.appspotmail.com Subject: Re: [PATCH] fs/ntfs3: Fix memory leak on ntfs_fill_super() error path From: Shigeru Yoshida In-Reply-To: <20220823103205.1380235-1-syoshida@redhat.com> References: <20220823103205.1380235-1-syoshida@redhat.com> X-Mailer: Mew version 6.8 on Emacs 28.1 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE 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 ping? On Tue, 23 Aug 2022 19:32:05 +0900, Shigeru Yoshida wrote: > syzbot reported kmemleak as below: > > BUG: memory leak > unreferenced object 0xffff8880122f1540 (size 32): > comm "a.out", pid 6664, jiffies 4294939771 (age 25.500s) > hex dump (first 32 bytes): > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ > 00 00 00 00 00 00 00 00 ed ff ed ff 00 00 00 00 ................ > backtrace: > [] ntfs_init_fs_context+0x22/0x1c0 > [] alloc_fs_context+0x217/0x430 > [] path_mount+0x704/0x1080 > [] __x64_sys_mount+0x18c/0x1d0 > [] do_syscall_64+0x34/0xb0 > [] entry_SYSCALL_64_after_hwframe+0x63/0xcd > > This patch fixes this issue by freeing mount options on error path of > ntfs_fill_super(). > > Reported-by: syzbot+9d67170b20e8f94351c8@syzkaller.appspotmail.com > Signed-off-by: Shigeru Yoshida > --- > fs/ntfs3/super.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c > index 47012c9bf505..c0e45f170701 100644 > --- a/fs/ntfs3/super.c > +++ b/fs/ntfs3/super.c > @@ -1281,6 +1281,7 @@ static int ntfs_fill_super(struct super_block *sb, struct fs_context *fc) > * Free resources here. > * ntfs_fs_free will be called with fc->s_fs_info = NULL > */ > + put_mount_options(sbi->options); > put_ntfs(sbi); > sb->s_fs_info = NULL; > > -- > 2.37.2 >