Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3409711rwa; Tue, 23 Aug 2022 04:25:35 -0700 (PDT) X-Google-Smtp-Source: AA6agR5FsnTtbYbaNwDvrubUn5E0NavziYK6aqHbBUuZ3lsQyHGYdFkKXRUp0/Btg4WA7SHewyng X-Received: by 2002:a63:1b0f:0:b0:42b:39a:4aa2 with SMTP id b15-20020a631b0f000000b0042b039a4aa2mr604394pgb.89.1661253935304; Tue, 23 Aug 2022 04:25:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661253935; cv=none; d=google.com; s=arc-20160816; b=tW7mRgcxhXjqoYgCPHxAvIV4M6nubaMndTOaZnVE7JfVYoR+DGKp9dxlB7WbTxU5q8 jNk74G6ZiAnlLbb3vDWwgMf2TXrPYao4swSgIufnGJAMyipfuGe2HgYl4LBvlF9j8F4K EDY3RI+swknXv2Qh6vBm0YSZLF8kzFUA6Uax9exvBVaM+7/CIYyKELbFVt48qcN6X1ab RdwzF5hctwXkof3WCSz7s7F/wckc1YWXvekBm/uBIllqc3GHorhD87ezfnutFsqphHUo vb81JeiIZ+gE6H8BF8hgW7Jxoef4WuyMKzvGVfKcBuNLNoPcFD9KM4+dPL2nGGW0rWmd n1Ow== 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=WNiu/gfhhTyhiRlntnIDkAzqyWZt1I8p++59hrgLm/E=; b=ugpE3I50WOtjDEiHJ6vlNggG1+FOqsgMt0dHT6/NTEmottIkC8GeMMF7KeNqPULlzh brtGge4BGy16QLwPXctsrTEBQgjCF2EG98VHtHpCwm9vzD9BqZm+0pKcYUw2P9m55Z/P KTRnr8PYZ3XzUHMldscsChxn8j2goqIvf9U/tQjdLLq5EOw0oMQPTVRaFgDjiUpdpTaf LDML+KOlAZxr26uFjymf+LTbawfjOo//ohBDQgAsfrq2Vy3qj6L1k9aJgsm7u3TxbPUU WvFGg3BarExwLSeW+u0R/tTbG/8Wx7ZtjZxeycfNj8tRs5Yyrf148QAFWGUioW1TKSZE AJ3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dhbyQToB; 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 mu17-20020a17090b389100b001fb0dc33897si9867347pjb.72.2022.08.23.04.25.22; Tue, 23 Aug 2022 04:25:35 -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=dhbyQToB; 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 S1352395AbiHWKFj (ORCPT + 99 others); Tue, 23 Aug 2022 06:05:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57710 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352083AbiHWKBM (ORCPT ); Tue, 23 Aug 2022 06:01:12 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EAEDA30F50; Tue, 23 Aug 2022 01:48:44 -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 ams.source.kernel.org (Postfix) with ESMTPS id 032D2B81C28; Tue, 23 Aug 2022 08:48:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 54825C433D6; Tue, 23 Aug 2022 08:48:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661244521; bh=W9WxLmYxGODJ81TG+pLggD5KFLjXaVnyk550yao84Bs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dhbyQToBvU9PEvhS5i0hQG1C9MSVKvMRT4OuIB5bwK5mRKFLE12crKDYsyuQ6MmIJ h2qpM1ehIWBsIxzV7c4V9KW3bjLo6Mw++pZ1a4RomYoTTKKXqkPPv5M9zQhGs60h9M A4p0bcIXCboFY1fAZv7nQQvLdNfo5opoyPELyWSA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Konstantin Komarov Subject: [PATCH 5.15 106/244] fs/ntfs3: Fix double free on remount Date: Tue, 23 Aug 2022 10:24:25 +0200 Message-Id: <20220823080102.559168824@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080059.091088642@linuxfoundation.org> References: <20220823080059.091088642@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; } @@ -901,6 +902,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; @@ -1264,8 +1267,6 @@ load_root: goto put_inode_out; } - fc->fs_private = NULL; - return 0; put_inode_out: @@ -1418,7 +1419,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;