Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1236742pxa; Thu, 20 Aug 2020 06:25:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw9WTHgLfjF4EbUfbq0IFbd0KonTCuJ7S2Ap+g6DN1ZWlBlnFx2PMSzQne4Dphk5Cjg6iAB X-Received: by 2002:aa7:db50:: with SMTP id n16mr2774562edt.292.1597929908700; Thu, 20 Aug 2020 06:25:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597929908; cv=none; d=google.com; s=arc-20160816; b=fdu82mBV9uGGlrjBIPC3fFBmXhKI0FE+PqciJwajrXX69arbmx0oe5vG0dNJrPO8Cy 7A/CKhwlkN0qaWVKWZ4gTeRB/uN7KEghEyX/UxsGG4H5gcpWB+we5+kx0vO8GbIsRg9C lY9OlVION8Qfiqs7q8FAC6d1bp97PtV99MOOXNTkHLmJ3PIGut17hIjVXwi0cvA+y2t9 LK/DZAW+odtQlfYiuIPu/77ZP51LStdiIxm+SC0+k5u7HJUGnHvC0UAmkCoItvT+8HDA qZ5YgnJA1A5U6b2nr+duApSNlIBTZdRcu7UoGm9bIheO48uCFfXwGK+l33JgQcC3Vmf4 escw== 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=JzKMzp7KHSlv0xU2f0OdYUJ/aYh0tcRnSV+YihfW/r4=; b=0DW5tZUzszdtzj4JhCxzqqoA5Xgk0YSEKLnSB8WSrPT35w++/fwhrIyVB6P99lNjNa 7sxBuP+C6CxeUVPyEi85LsdopCzGn2QmKnFOAXvmPNRPl53XSV2tJEXBUFrUYiNZZFYS q/Ay/p5Kug8ehvHKNX3nKo4VgZVoJ6Zs6AZuFCDUsOhkJxdJwAG4SHMSUzN5DuRe87c+ ABb+HbRr7OQSKB9eWmstiIL0NGZ2osanwAOsJet6i4ebT8xVraTakxwpwEA+ejC/CEIf yBa3dvBPyFBLckuHE0gB+81WfNpSDFBVnRuULCTkZnm99DHl5Q1tAKQYvI4ui2CvLOAi FM8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=IXJuuQtr; 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 u15si959187ejx.53.2020.08.20.06.24.44; Thu, 20 Aug 2020 06:25:08 -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=IXJuuQtr; 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 S1730149AbgHTNYH (ORCPT + 99 others); Thu, 20 Aug 2020 09:24:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:47024 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727075AbgHTJeM (ORCPT ); Thu, 20 Aug 2020 05:34:12 -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 0076822CA0; Thu, 20 Aug 2020 09:34:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597916051; bh=Q1zIU5SuzkyJ10BIgp1gFKULbwqkncB9RaWdhQ0CRdY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IXJuuQtrNTArGW2DkDW5IKD6stb491fJyg2wcCIKc0rtBNqpi/gW5jTrp0aDWPl7q n/KdlUQv7iHIWrEzhrT9Rj+hFv1wXOxesvysCgTGDtYsj2zudhqOTxgI71WeN0j/kp Q2TJViNKJSK6pXyLAcvquv0CdPPs7QhBvtdPraq0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Guoqing Jiang , Song Liu , Sasha Levin Subject: [PATCH 5.8 187/232] md-cluster: Fix potential error pointer dereference in resize_bitmaps() Date: Thu, 20 Aug 2020 11:20:38 +0200 Message-Id: <20200820091621.853179966@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200820091612.692383444@linuxfoundation.org> References: <20200820091612.692383444@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: Dan Carpenter [ Upstream commit e8abe1de43dac658dacbd04a4543e0c988a8d386 ] The error handling calls md_bitmap_free(bitmap) which checks for NULL but will Oops if we pass an error pointer. Let's set "bitmap" to NULL on this error path. Fixes: afd756286083 ("md-cluster/raid10: resize all the bitmaps before start reshape") Signed-off-by: Dan Carpenter Reviewed-by: Guoqing Jiang 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 73fd50e779754..d50737ec40394 100644 --- a/drivers/md/md-cluster.c +++ b/drivers/md/md-cluster.c @@ -1139,6 +1139,7 @@ static int resize_bitmaps(struct mddev *mddev, sector_t newsize, sector_t oldsiz bitmap = get_bitmap_from_slot(mddev, i); if (IS_ERR(bitmap)) { pr_err("can't get bitmap from slot %d\n", i); + bitmap = NULL; goto out; } counts = &bitmap->counts; -- 2.25.1