Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp1255346imw; Tue, 5 Jul 2022 06:30:57 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sVv+JUkuLEoPFD0iRITp+AOxe3lKOkFXcvCElq+jwVtVVyASYDE+MkmtpAkSjMzbWkHHdh X-Received: by 2002:a17:902:ed02:b0:16b:d5f6:2c17 with SMTP id b2-20020a170902ed0200b0016bd5f62c17mr17059083pld.85.1657027857023; Tue, 05 Jul 2022 06:30:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657027857; cv=none; d=google.com; s=arc-20160816; b=c5ZBvSbAi8+pR3hnu90eKBV9XQvKtVUyeHweWGhMCMvkdcwqKWoy7J7XkbKFhoMMnM DnanBtyMXfa5je38Osp3HWODvTMV2HF9ihgY+uzRfERGVh63ny7GJTCtS30GkkQkqkZC X6PrRWQK3UHjvTdZaxhJfPSofMr+SFrntChDYIF8ar/Za1UID/Sw87M/mkjfP2qASybQ 7OEn1LtEOS8YVhXNkbEhrogdSyk96D88x0lW/hVGpU4/P3UWOlr1OF+a3wAs5AFq0N5a FN31yAxyGHrlsgaSFhCqBS2RtoOTMFLCjKkF7n+ltgahUJ7PDuvl9CFpwGbhD0jjc1gU 1hgw== 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=C4WOms9JqUen0+r0du4XpG67Dr/iiTBjIHqtC4gi57M=; b=V4eTXsKvwXR3tDC9IhOns/WTf+exw9i1CcEhGsPk7bUgk9zQBqQg5iszGPbuBmdeWZ YFKeAYmtTKqq3usi6UAY5/N5mbVs84r983QgK+pEhl7Dk29vowZNgPpUqoUec8yglFHC 9GGPJrim5xDmN6+TY7I5em+bsPMSPIhT3HHJiI8NSkhdrfOlzkEM+tXXxplTVI8iXjnT VjLpBwobv7Phb6t0pMqmbKprJuiTi1yEDf5N/TmxIo2tUJ5aZKanbDulX+cNV6NxdSnf wFb4VltOpngh5rm4E9CTawzR+FuYLfkwXYUwZX2WcpVPcYrRR+ZcVx/vyE4LDhCFL9h1 JM8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KlTfuwBX; 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 j7-20020a170903024700b00163e9849d54si30143968plh.214.2022.07.05.06.30.45; Tue, 05 Jul 2022 06:30: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=KlTfuwBX; 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 S231917AbiGEMDX (ORCPT + 99 others); Tue, 5 Jul 2022 08:03:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42830 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231465AbiGEMBx (ORCPT ); Tue, 5 Jul 2022 08:01:53 -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 0FB25183A2; Tue, 5 Jul 2022 05:01:48 -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 9310EB817D3; Tue, 5 Jul 2022 12:01:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E1C9EC341C7; Tue, 5 Jul 2022 12:01:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1657022505; bh=c6vtjDsUvTnnXR8XpyHcPF4t2AXKtHHBZEfEQCOfs4E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KlTfuwBXzT/Lswa+N1RD0F8ph0fmZ7isU6YHHcZOU5QxgT5ZkncSUra0vVUStOHap SM6XpFR/bkgUlG3fL1E8uOPtkeRoLxp9JfAJMMYI16L0tSWkHSzNcWMMyPVnaMCmNT RO1GUqEqmRECtwcHI6ymV0ib9my2W5oTfhOmFV54= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mikulas Patocka , Mike Snitzer Subject: [PATCH 4.14 03/29] dm raid: fix KASAN warning in raid5_add_disks Date: Tue, 5 Jul 2022 13:57:51 +0200 Message-Id: <20220705115606.440077428@linuxfoundation.org> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220705115606.333669144@linuxfoundation.org> References: <20220705115606.333669144@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.8 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: Mikulas Patocka commit 617b365872a247480e9dcd50a32c8d1806b21861 upstream. There's a KASAN warning in raid5_add_disk when running the LVM testsuite. The warning happens in the test lvconvert-raid-reshape-linear_to_raid6-single-type.sh. We fix the warning by verifying that rdev->saved_raid_disk is within limits. Cc: stable@vger.kernel.org Signed-off-by: Mikulas Patocka Signed-off-by: Mike Snitzer Signed-off-by: Greg Kroah-Hartman --- drivers/md/raid5.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -7689,6 +7689,7 @@ static int raid5_add_disk(struct mddev * */ if (rdev->saved_raid_disk >= 0 && rdev->saved_raid_disk >= first && + rdev->saved_raid_disk <= last && conf->disks[rdev->saved_raid_disk].rdev == NULL) first = rdev->saved_raid_disk;