Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp1961369rwe; Fri, 2 Sep 2022 06:38:57 -0700 (PDT) X-Google-Smtp-Source: AA6agR4/xPA8LBauWcCehz3jd6GEaPNgDicsomwmd3OuIZm1NmbGbE9WGWHMmDnhgg8rov/hG1at X-Received: by 2002:a17:90a:e7c2:b0:1f5:85ab:938c with SMTP id kb2-20020a17090ae7c200b001f585ab938cmr5018606pjb.133.1662125937014; Fri, 02 Sep 2022 06:38:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662125937; cv=none; d=google.com; s=arc-20160816; b=ccJccF+lO0rhCFMtV2+lkSG3gOid3Dp9OBQdS/brC/Gbsje83tTa7Y/bD1hPdfd3xA I9bdMTwMgMYj+vyCoWrqeAF27KtYCvAP37+OyAPoQeUHX6R5CuNuBGG0C5xdNapA3H4L tP+XahtQ287i/VWHu4U5Vav3LfmQgpSjxWhP3nYUyVRCNXaR/dSMethXtxEdnPoE6AWJ t/CmB9exclW9tFqwlucjx9ncWOhM94aB0QTwPJK7QlNks9R4slWHF56AFNXrq16UBzyz sYfzMKMjBsc2MQv9htSvFZSrptyqqRv8svF4GIekFsslKGRhbrAxBW1oc9vCvlP2CO8/ tx2Q== 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=XsmSwZ/qL+CS2Q1MKBsLSVxxVkJZLeFT61AbeXJlky0=; b=rDyMWZjSbRpsLSlY7x0YGM5nE0JY75MQ9hxX2uuwYIsOdY6Su2fXGKErAKSzR+TdMt GMT5uWfWXMlLHH04WqaGWHw7z9Ha5cPtZ/9mkliMkbA5HBE8tHabH0SwsvR7w+WMKcdc 1bi40GZxKJHHi+JcoIpLIXPY3FtfB80zqelSx7F+ZNc6q8gpQiGGKJp7s7wGVe5lJhPe eiWmLm6fBdpmJlWl3GR3RMi+tvJSdPMRIZWuevpV1gMNp615Mu51TVs51DqyPwN3Z6XZ cDIZjc3YUchCDFZyN+1VLCmZ3MH4Vq06h+6+s1YFKi+UWZjbtUiJL2NOkLqX8JRE7202 54bg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=TqsvRHYm; 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 x38-20020a631726000000b00408c2ac7412si1919432pgl.660.2022.09.02.06.38.41; Fri, 02 Sep 2022 06:38:57 -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=TqsvRHYm; 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 S236914AbiIBMhA (ORCPT + 99 others); Fri, 2 Sep 2022 08:37:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54758 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237022AbiIBMgS (ORCPT ); Fri, 2 Sep 2022 08:36:18 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D03CDF4E9; Fri, 2 Sep 2022 05:28:50 -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 1C9C7620B6; Fri, 2 Sep 2022 12:28:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1191BC433D6; Fri, 2 Sep 2022 12:28:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1662121729; bh=GTRHNUjiLIuDq28pzbsM/VXRXBn3isvL/+qqfFlwepA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TqsvRHYmM+n97QOZVikbv7S9zm8q4YHWhFBmtK5QBxTBKvz+A6SqhRay4UJGm/fHn 3+MrC705A4jV94duxdNA8vQ5JrwYW3KUsnon/+Eh6XK1NKnm12xcO7eFaY+sWKnVE/ gFi0CrO0OlT41dxrzsR9cgI5WwO+IFSiDGZjqvDA= 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.4 46/77] md: call __md_stop_writes in md_stop Date: Fri, 2 Sep 2022 14:18:55 +0200 Message-Id: <20220902121405.184054467@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220902121403.569927325@linuxfoundation.org> References: <20220902121403.569927325@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 @@ -6094,6 +6094,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);