Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp2438922ioo; Sat, 28 May 2022 13:44:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy5UUU1dIyO8IW/fCmPCY/LY14BBx8BLRpUAm6rdymLZlcnvBwWrseBk3nnE1OhSZnWjIkf X-Received: by 2002:a17:902:f647:b0:161:67af:6bf0 with SMTP id m7-20020a170902f64700b0016167af6bf0mr47282206plg.100.1653770641526; Sat, 28 May 2022 13:44:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653770641; cv=none; d=google.com; s=arc-20160816; b=DU6hd7OXC5f0P1m/nLJQ0ctt0vRULzh9iwuukK2cwFB9x258/DIbq12Zs8moRCQtu8 mrDKdLtHo6ai3gJWWp7dV5sNKSF7lOvYjc59/R9Pe6yj0hrkQ7R5ZAWBy8y9wHQLO3m2 Ib3OqGEs/NYHnIb/gUZgvkW6147IRSEoViMmKec05aUZZ96ZcRZ3wrfEDK0DF4fMjuwA FxG5UUpFnVA58JoZ9sju/RR5F0CRJh9gW3lE9ep1663/yLYtd02Vo+w5zXG8nGsqm8y4 sSYS1uG2EzjLyIyrV3IbZnHTviqbnNVheAc3NXvZihI4P5zcMoXhrazB7YuB9jGy4AGU PlSQ== 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:references :cc:to:from:content-language:subject:user-agent:mime-version:date :message-id:dkim-signature; bh=gY524lf/gzPmcrcGqzOWu5zx71hGf3abpPOyo+Ffr80=; b=htQy2ORQeJxg4tA3gzrBl3f2GQ99gQKnpkbhUjZw2nKRzXYkV+PE+h/1xAX+0RNMmR nyUgZmxhXYByVF/8Bnmi7zB42sUAm0as/celBNruP7MY0lywBGmg5vurDePV9LXLdvCB 4xZkAuVoZlsK8gOowaltJQfFA28ke5picu/X3ksWOX6kBO2lxhuzN9GIU8SNqmNng44q /jwETohuWhwO/O3/eUEGqn62fqporfCSQAE4+sHKpAANwu0yn5462JTH9P+FWw5Je5QA HQXqGgWQatgAga/m9UIiw/2rTDZ6X6v/FLpP9gaL/b4yZ+nKg3Lsc6hY4CbbKJUZ9/YA sCqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@paragon-software.com header.s=mail header.b="ED7kfG/v"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id u62-20020a638541000000b003fa8e741384si11116980pgd.727.2022.05.28.13.44.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 May 2022 13:44:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@paragon-software.com header.s=mail header.b="ED7kfG/v"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 65D959981D; Sat, 28 May 2022 12:43:41 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352573AbiE0OWI (ORCPT + 99 others); Fri, 27 May 2022 10:22:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40346 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350235AbiE0OWG (ORCPT ); Fri, 27 May 2022 10:22:06 -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 BCCF234BAE; Fri, 27 May 2022 07:22:04 -0700 (PDT) Received: from dlg2.mail.paragon-software.com (vdlg-exch-02.paragon-software.com [172.30.1.105]) by relayaws-01.paragon-software.com (Postfix) with ESMTPS id 297FA2629; Fri, 27 May 2022 14:21:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1653661295; bh=gY524lf/gzPmcrcGqzOWu5zx71hGf3abpPOyo+Ffr80=; h=Date:Subject:From:To:CC:References:In-Reply-To; b=ED7kfG/vEm9bI9Gft1ivzFLUVj7DPujpoJSWZZ3ri7HXf/QnknuRrlbU5HZZFeLw2 7pjwBE5E3/+KwmjYBuVk/JhlgqYK5Gxkp6n4d0H/rE2JMjikDDyr8cT4incsbuhty9 Mk53R8mjisNgLESqwNw7IVtS+aPEPTZLbiYlbu9I= 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, 27 May 2022 17:22:02 +0300 Message-ID: Date: Fri, 27 May 2022 17:22:02 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Subject: [PATCH 2/3] fs/ntfs3: Fix double free on remount Content-Language: en-US From: Almaz Alexandrovich To: CC: , References: <75a1215a-eda2-d0dc-b962-0334356eef7c@paragon-software.com> In-Reply-To: <75a1215a-eda2-d0dc-b962-0334356eef7c@paragon-software.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [172.30.8.65] 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.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Pointer to options was freed twice on remount Fixes xfstest generic/361 Fixes: 82cae269cfa9 ("fs/ntfs3: Add initialization of super block") Signed-off-by: Konstantin Komarov --- fs/ntfs3/super.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c index d41d76979e12..697a84ed395e 100644 --- a/fs/ntfs3/super.c +++ b/fs/ntfs3/super.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -390,7 +391,7 @@ static int ntfs_fs_reconfigure(struct fs_context *fc) return -EINVAL; } - memcpy(sbi->options, new_opts, sizeof(*new_opts)); + swap(sbi->options, fc->fs_private); return 0; } @@ -897,6 +898,8 @@ static int ntfs_fill_super(struct super_block *sb, struct fs_context *fc) ref.high = 0; sbi->sb = sb; + sbi->options = fc->fs_private; + fc->fs_private = NULL; sb->s_flags |= SB_NODIRATIME; sb->s_magic = 0x7366746e; // "ntfs" sb->s_op = &ntfs_sops; @@ -1260,8 +1263,6 @@ static int ntfs_fill_super(struct super_block *sb, struct fs_context *fc) goto put_inode_out; } - fc->fs_private = NULL; - return 0; put_inode_out: @@ -1414,7 +1415,6 @@ static int ntfs_init_fs_context(struct fs_context *fc) mutex_init(&sbi->compress.mtx_lzx); #endif - sbi->options = opts; fc->s_fs_info = sbi; ok: fc->fs_private = opts; -- 2.36.1