Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2654853pxa; Mon, 17 Aug 2020 15:38:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwNgfaEzenmTwQk/DwPHVUuL1vSgsqik2KfWHHv3YVfuA4guD0m9qrGrtpYM1F5RLSYM5vN X-Received: by 2002:a05:6402:7d5:: with SMTP id u21mr17917176edy.341.1597703907005; Mon, 17 Aug 2020 15:38:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597703906; cv=none; d=google.com; s=arc-20160816; b=OZ6czY65YrMeL6r/jFlYa6Rt6on9nWmCtG4HA4a/Pqw/vZa81hNOnkDFfVMY/7S6ny NOJu6VSvTe716rY8YWTs0LT9NJ4Vgc1u9m7wa/aC0gJxRN6M8nPujtsz47HhxYZROmCd Vk821J9eyY15pbKAHOEzSYwqRMlN84SmzMD9m8OG7D0WObUY3+p/tyuHsrYXffEVfVUv gkkStfVpbLwGLx+6rr12VfGd9IicSVTAkh1CeOCdY58b6MKERFh1nwHErASILxoxkj/A Lwt2bwBJDmrU6D65GmSXasF/+r4tHgspyns6Jc0v4JGnNhnbGV09JId3aX1K+0HTJ4SQ 0jhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=YG6fbPU66LUXjqNvELlltM8gM7kfcCCjuFRuUONUrOc=; b=Qpa19T9Cb2rKTutgNNyYxnxgMxXul2kxQbL5wvAJtXnqS4yZbxWcNdhKT9F/gza7HM xPIIkyW3GCBfJxOflSSAl8GDEQaqk5AzCX5cKW3kbHQUW57+ufTI5yt8JNF6ioPpA0py 8KOVQVkYkhRBjuY9A7EwR9j79qzkPesdhTUkFTkwE4ioULlwKqzpS0EVWhQwmO+Mzlew sMPWbIa/RnplY800lSJ11Cwi6FKL1dmj6OzY2cL3gDW6J4bJ8AK0jk0NSTtNm+0V9l6E 3tmajttTgnwBD/C2nlRdVAwhNdcmGHG0+9irQRHDKzYEDRLO26rCxb2rdigUhBYxMKCr Nlow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=DyjOTcza; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b13si12822474ejq.223.2020.08.17.15.38.03; Mon, 17 Aug 2020 15:38:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=DyjOTcza; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390126AbgHQRsz (ORCPT + 99 others); Mon, 17 Aug 2020 13:48:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:45914 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388206AbgHQQMz (ORCPT ); Mon, 17 Aug 2020 12:12:55 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E65B522CF6; Mon, 17 Aug 2020 16:12:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597680774; bh=9nw175VTUt9xRYhz+9RVJtICSl5yjiAvvwarFbRrSug=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DyjOTczalzFH6opbv0sZkn/aJ+GAkL3UOp1UPPVhlBkVLcLHxaur1LU2XBm/jjoIv GYRiJuTq6uADqcfO6iL3rZXoWRirWunAk+YqnQR523ZS+6J+drF5bpEXfrwL7IJj8H U8sA6punOODFx33mm8HO6abTHHDRaMSWDq81FM58= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhao Heming , Song Liu , Sasha Levin Subject: [PATCH 4.19 034/168] md-cluster: fix wild pointer of unlock_all_bitmaps() Date: Mon, 17 Aug 2020 17:16:05 +0200 Message-Id: <20200817143735.465770228@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200817143733.692105228@linuxfoundation.org> References: <20200817143733.692105228@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Zhao Heming [ Upstream commit 60f80d6f2d07a6d8aee485a1d1252327eeee0c81 ] reproduction steps: ``` node1 # mdadm -C /dev/md0 -b clustered -e 1.2 -n 2 -l mirror /dev/sda /dev/sdb node2 # mdadm -A /dev/md0 /dev/sda /dev/sdb node1 # mdadm -G /dev/md0 -b none mdadm: failed to remove clustered bitmap. node1 # mdadm -S --scan ^C <==== mdadm hung & kernel crash ``` kernel stack: ``` [ 335.230657] general protection fault: 0000 [#1] SMP NOPTI [...] [ 335.230848] Call Trace: [ 335.230873] ? unlock_all_bitmaps+0x5/0x70 [md_cluster] [ 335.230886] unlock_all_bitmaps+0x3d/0x70 [md_cluster] [ 335.230899] leave+0x10f/0x190 [md_cluster] [ 335.230932] ? md_super_wait+0x93/0xa0 [md_mod] [ 335.230947] ? leave+0x5/0x190 [md_cluster] [ 335.230973] md_cluster_stop+0x1a/0x30 [md_mod] [ 335.230999] md_bitmap_free+0x142/0x150 [md_mod] [ 335.231013] ? _cond_resched+0x15/0x40 [ 335.231025] ? mutex_lock+0xe/0x30 [ 335.231056] __md_stop+0x1c/0xa0 [md_mod] [ 335.231083] do_md_stop+0x160/0x580 [md_mod] [ 335.231119] ? 0xffffffffc05fb078 [ 335.231148] md_ioctl+0xa04/0x1930 [md_mod] [ 335.231165] ? filename_lookup+0xf2/0x190 [ 335.231179] blkdev_ioctl+0x93c/0xa10 [ 335.231205] ? _cond_resched+0x15/0x40 [ 335.231214] ? __check_object_size+0xd4/0x1a0 [ 335.231224] block_ioctl+0x39/0x40 [ 335.231243] do_vfs_ioctl+0xa0/0x680 [ 335.231253] ksys_ioctl+0x70/0x80 [ 335.231261] __x64_sys_ioctl+0x16/0x20 [ 335.231271] do_syscall_64+0x65/0x1f0 [ 335.231278] entry_SYSCALL_64_after_hwframe+0x44/0xa9 ``` Signed-off-by: Zhao Heming Signed-off-by: Song Liu Signed-off-by: Sasha Levin --- drivers/md/md-cluster.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/md/md-cluster.c b/drivers/md/md-cluster.c index 0b2af6e74fc37..4522e87d9d68d 100644 --- a/drivers/md/md-cluster.c +++ b/drivers/md/md-cluster.c @@ -1443,6 +1443,7 @@ static void unlock_all_bitmaps(struct mddev *mddev) } } kfree(cinfo->other_bitmap_lockres); + cinfo->other_bitmap_lockres = NULL; } } -- 2.25.1