From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AE370ECAAD2 for ; Mon, 29 Aug 2022 11:36:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232830AbiH2Lgc (ORCPT ); Mon, 29 Aug 2022 07:36:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41764 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232154AbiH2Lf4 (ORCPT ); Mon, 29 Aug 2022 07:35:56 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CF2697E320; Mon, 29 Aug 2022 04:20:51 -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 9768BB80EFA; Mon, 29 Aug 2022 11:18:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DA9B8C433D6; Mon, 29 Aug 2022 11:18:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661771906; bh=pp1K60d+bAPmwzR6F+LVuC53PVa7MXLH3HOEvGhGyNI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ujtZEH6GQbAsq2xk0AopW2CihNgDQh6OwP4ug5vPG/VwMiVuEg01MgJAMetgsuW4U 7fFkuAAHg6Oh8hZKK44I4v2gX9bkjWumjcGspDSqGxvo2IQODsxJ2t4y3wrU9SeWI7 57ieDg0dspG2Y/V507wuLhN2bys277uZK5WYAcYI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mikulas Patocka , Guoqing Jiang , Song Liu Subject: [PATCH 5.19 136/158] md: call __md_stop_writes in md_stop Date: Mon, 29 Aug 2022 12:59:46 +0200 Message-Id: <20220829105814.778624942@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220829105808.828227973@linuxfoundation.org> References: <20220829105808.828227973@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Guoqing Jiang commit 0dd84b319352bb8ba64752d4e45396d8b13e6018 upstream. >>From the link [1], we can see raid1d was running even after the path raid_dtr -> md_stop -> __md_stop. Let's stop write first in destructor to align with normal md-raid to fix the KASAN issue. [1]. https://lore.kernel.org/linux-raid/CAPhsuW5gc4AakdGNdF8ubpezAuDLFOYUO_sfMZcec6hQFm8nhg@mail.gmail.com/T/#m7f12bf90481c02c6d2da68c64aeed4779b7df74a Fixes: 48df498daf62 ("md: move bitmap_destroy to the beginning of __md_stop") Reported-by: Mikulas Patocka Signed-off-by: Guoqing Jiang Signed-off-by: Song Liu Signed-off-by: Greg Kroah-Hartman --- drivers/md/md.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -6266,6 +6266,7 @@ void md_stop(struct mddev *mddev) /* stop the array and free an attached data structures. * This is called from dm-raid */ + __md_stop_writes(mddev); __md_stop(mddev); bioset_exit(&mddev->bio_set); bioset_exit(&mddev->sync_set);