Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp3056639rwe; Mon, 29 Aug 2022 05:14:55 -0700 (PDT) X-Google-Smtp-Source: AA6agR7sN/PIdz0tMzevVExGSL8T5NtWOldbZ4RJ7mvHGUOB450pk5on5/bJWQX1PVwPcvrNTzm5 X-Received: by 2002:a17:902:8ec6:b0:172:dc2c:306d with SMTP id x6-20020a1709028ec600b00172dc2c306dmr16588034plo.104.1661775294752; Mon, 29 Aug 2022 05:14:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661775294; cv=none; d=google.com; s=arc-20160816; b=bFaQm8BZ9Oo2g1uASoNT5bBDNMGfjvQuxvOJSpdXs7N9jnpZjwy3Z4UWfIyp2J/8kL QNnl+KVoQdxvi5SLevHHbf/KfuArpftxWJyxVJHAlogb95OBADAWKNXx+TFitqy+3geQ CwziSMe98SyFVR1UIe47Qtqg9d/F8BOegckJSkxWCYubhSCYwQz1Mfrs4b9fKzVsf1IL 8jdMEd3aIM4oGtSXfIkvyPrzMlFSBZQicNAJ0uoXUY+BQoRqhzeyVGSKJYM07XO9BaGm c2jcmFDJ4RLzxnDfKROEWZe/xaSVcGqKNk74cJy+BdG/8Dx/YztntFWxDF0V88npoFnL 4tgw== 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=Uz8lrQ/XvDSJLix6lwtPpCwTYd5Q90bCf2Ck49eExlY=; b=ceGgzV33FjzeWFlH67RN/d/IJp3SYvh51pXWAF387Ugles+T/ePYRZ1BGC3rqgL9MH IY3/5BTWoEwxemPTcorAjsM6HkzkAmsQms6AO1gC7gfkPigX8wcxGoSK/23OtuKvIUFe +TEdu8+huSHwct/TRtxy2pDHQW6FXjtSEOB1A24cF+w5xvyi+TSqWMHUi6o4nwp1fkJv XIx8wKjbgmmtTvTpOM7mZhD0GfURZXQfOlOXGoKGh8oGF0WSqJ3e50RzJATRRJx/23P6 PoI2hFNTJcWORrlbmEewP2DRJScAEp+thiGVxrdaGeMM6BLREl3h9LMJIYnaXZo63JR7 E8DQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ujtZEH6G; 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 c24-20020a6566d8000000b0041d35693195si8732121pgw.67.2022.08.29.05.14.42; Mon, 29 Aug 2022 05:14:54 -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=ujtZEH6G; 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 S232842AbiH2Lgn (ORCPT + 99 others); Mon, 29 Aug 2022 07:36:43 -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 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: 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);