Received: by 2002:a19:771d:0:0:0:0:0 with SMTP id s29csp1275722lfc; Wed, 1 Jun 2022 13:55:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwXniNlY0AIRc34GbKSW9hQYPMHOqw5+8UD6plo/8ztgU1wKKxZF0OVHV30w9uQ525l3K0j X-Received: by 2002:a17:902:8c90:b0:163:b989:3cd6 with SMTP id t16-20020a1709028c9000b00163b9893cd6mr1258909plo.170.1654116916202; Wed, 01 Jun 2022 13:55:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654116916; cv=none; d=google.com; s=arc-20160816; b=YUDIXqpkFZXFk/Vh14t0Yp6x2lyzO11Qhm27vgGmmCwvyGOw3nfRoTjzHazIo3K98I pod1IW4bLOb9N7liUqqBJhxpsKrewG2YhFrm024jVMu7S+wCNRF9ExoEIP6ZxON4t5w8 vkLO0Sjct9lEoW3bSZkB8+GTL1nr75C1XPhY2VoYs2jK+Mx/z9HF5bFNkSe01dXFGBc9 6FQIjgWVz7T4XbAiYRsHDoA4Z2cnC0HfrTo7uRYvhVowyAuVlCoXHCfwrYcA4qwRDZS1 Ow9RnRa0/KeSibGljhHOHso1XAbWLLkf5B1FvDJD+6XcTk47dJKn3vzY+/cmSUxypvDK CWHQ== 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:dkim-signature; bh=gY524lf/gzPmcrcGqzOWu5zx71hGf3abpPOyo+Ffr80=; b=w8X3lDAohoReSqOGGhbNZoskwPPpVj1vI5cymy59R57kXcbDbtpc6nRPciqL5AHEM1 ZPwNFvwSzQnZtV/wElO9ffXvw2yVGh/mDoLGhPAaYZiyux6bLkB5sulad24FGgDnLqrm G/fzD05iYhNiWTY/k5oYQnIT7z6/p2SDeBZG9e7ZdYZkgrIQESDKScDVxUDX/LoFf8BN XsHu4EnDRcrrP9q0HJcNy6FZEW1ydv2Rw/iZEAtZfWAeeRALzQ8s/+thCuo99Rtw+DWR oWtA4giBQmF8FNumwyUlNSt5HawWEAU/tdiVJjFyvlzoX7Zi7ugVG4jluUKvrdJgqL/R d9Ww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@paragon-software.com header.s=mail header.b=ntNuaaKQ; dkim=pass header.i=@paragon-software.com header.s=mail header.b=PhOMUaZN; 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 t1-20020a17090340c100b0015eabaaa16fsi3020112pld.578.2022.06.01.13.55.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jun 2022 13:55:16 -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=ntNuaaKQ; dkim=pass header.i=@paragon-software.com header.s=mail header.b=PhOMUaZN; 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 4B4FC2B2EA6; Wed, 1 Jun 2022 12:56:49 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240560AbiE3QkG (ORCPT + 99 others); Mon, 30 May 2022 12:40:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238150AbiE3QkF (ORCPT ); Mon, 30 May 2022 12:40:05 -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 679696470E; Mon, 30 May 2022 09:40:04 -0700 (PDT) Received: from relayfre-01.paragon-software.com (unknown [172.30.72.12]) by relayaws-01.paragon-software.com (Postfix) with ESMTPS id 288271F86; Mon, 30 May 2022 16:39:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1653928772; bh=gY524lf/gzPmcrcGqzOWu5zx71hGf3abpPOyo+Ffr80=; h=Date:Subject:From:To:CC:References:In-Reply-To; b=ntNuaaKQ7pBH44imN202AJvn/CRhGayiUZuG5JZKdsgFLrbXs3FNyYsAyBNMjUadl mEVHggE1H5OHT3SD2WwmPuBJEtjICfQiSqDpGsW27XGWGYSwkM6SQskOtY6TetA3DG RhHG+Pz44G9/nwJ+w5k9RJI/KJ3hZls0ij+TDFxI= 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 69D6F21B3; Mon, 30 May 2022 16:40:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1653928802; bh=gY524lf/gzPmcrcGqzOWu5zx71hGf3abpPOyo+Ffr80=; h=Date:Subject:From:To:CC:References:In-Reply-To; b=PhOMUaZNBR+9naglTsx3/PSB5UyAx1dQngqhqke4mWG8NvujQzOe7kVbWPfXJdcOh vcVPqsqcW1dhuHy3B/JAackGCgFbTicG1AWHI0JqTD6+ZMveWQ7nyCnomU6BfJsD48 wHkdeq+mgaUYTiYwdXNYl96RjnIVTLGMed5Vdkh4= 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; Mon, 30 May 2022 19:40:01 +0300 Message-ID: <9dee6fd3-ab6f-b51a-b494-b579e537710b@paragon-software.com> Date: Mon, 30 May 2022 19:40:01 +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 v2 2/3] fs/ntfs3: Fix double free on remount Content-Language: en-US From: Konstantin Komarov To: CC: , References: <6afbf4c7-825b-7148-b130-55f720857cb0@paragon-software.com> In-Reply-To: <6afbf4c7-825b-7148-b130-55f720857cb0@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