Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3407488rwa; Tue, 23 Aug 2022 04:23:14 -0700 (PDT) X-Google-Smtp-Source: AA6agR6k33/uEiMUCb1HW7F2ncoe3CXpGglhY2HadMYmWm/vfgG7mQEHgIDWVKi83QKIwD+fqoAm X-Received: by 2002:a17:90b:1a88:b0:1f7:3daa:f2f6 with SMTP id ng8-20020a17090b1a8800b001f73daaf2f6mr2866056pjb.245.1661253794484; Tue, 23 Aug 2022 04:23:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661253794; cv=none; d=google.com; s=arc-20160816; b=Soh+lysE+yr7GUM308pBqxznmdUqyrRYxNz4DiQrEflIvcMDQYYjKbLgY2rg7pE78m ZbdjQXlnSRJE7rHr3wMJhwFYUGtCczg7mNLCEwLJ/7yAKn3BZnoqm17RVc0lEymX9sb/ eIbDIAUODA7dbh2mW8RzP2E4sKpfeVBLauzEPB4y//bGuRyyVzjLuqQVswiFCpM3YvQX CIECbrtAtmtBuooEHvWOkU+P3AFV0NMMaOeWz/dszNwa1+wUPw6QS5ar8PMALaJEtSCj CI5wUkyClSEg69OmR7zShZJUrDwKEKVJj4JD4uGb2xYVx7qFWboDG9+mYI8UyIaz1/9Z rUhQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=M0bl5INIiiAiNK7KzmgiHyUWcLIUcIV7Tz7X86YkZu0=; b=kYrfNGVjJVWaUcdKopLV/IjT4dwrw2mIUQTXXZ6EzRLFajM96EiV80DYft+xR70NIK HA/YevvMx8uJTNdIKQrvb2amSa170/nMDOHKx83fzvmUi88nBNGbtCCBnkFFULQmgdeE NzhNVsl7iqqagoJXikiTjHzhH2SKWrUTrDeFK2AzbOytsvMByp6hMBiqnU0TEUY9qb0B vMigZS2JJgYXtqdCSEFe7NYUNWJ9J+m9z/IprwdP52CiuvJLDknlbPLAU8TWmCe4AgXJ GTvAmUHvAEYJdBRaNzrf7uiR3HOlnQ3cRHAo5kR+ojZRsqTr9rkkYnvCXxDOw8qxiwm1 5e2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pl6XJIo0; 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=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 3-20020a630003000000b00429a7919f37si8726348pga.458.2022.08.23.04.23.03; Tue, 23 Aug 2022 04:23:14 -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=@linuxfoundation.org header.s=korg header.b=pl6XJIo0; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346195AbiHWIjs (ORCPT + 99 others); Tue, 23 Aug 2022 04:39:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344526AbiHWIjJ (ORCPT ); Tue, 23 Aug 2022 04:39:09 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BD5BC263D; Tue, 23 Aug 2022 01:18:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4176E61344; Tue, 23 Aug 2022 08:18:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4558BC433C1; Tue, 23 Aug 2022 08:18:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242694; bh=irptwIDxqF2pKji92Dk04MOvhgeuIDxlQ8Rc8roUWe8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pl6XJIo0KsjbGmuwVD4FNVtUUCgcnzabNOFEfs4LEvenfE4en1oX6T7tMF/oNTLw3 rLHr4WdtUmGlhM9bl7js7CZV3H364DgiEtATG9r4GWZrMRxSplPbBp330M85MeyL6x LgiXUqPG/ks9GvNDI884s22lhAOrYvOSFfeMOMgA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Konstantin Komarov Subject: [PATCH 5.19 163/365] fs/ntfs3: Fix double free on remount Date: Tue, 23 Aug 2022 10:01:04 +0200 Message-Id: <20220823080125.031762428@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,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 From: Konstantin Komarov commit cd39981fb92adf0cc736112f87e3e61602baa415 upstream. 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 Signed-off-by: Greg Kroah-Hartman --- fs/ntfs3/super.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- 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 return -EINVAL; } - memcpy(sbi->options, new_opts, sizeof(*new_opts)); + swap(sbi->options, fc->fs_private); return 0; } @@ -900,6 +901,8 @@ static int ntfs_fill_super(struct super_ 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; @@ -1262,8 +1265,6 @@ load_root: goto put_inode_out; } - fc->fs_private = NULL; - return 0; put_inode_out: @@ -1416,7 +1417,6 @@ static int ntfs_init_fs_context(struct f mutex_init(&sbi->compress.mtx_lzx); #endif - sbi->options = opts; fc->s_fs_info = sbi; ok: fc->fs_private = opts;