Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp6014299ybc; Wed, 27 Nov 2019 13:24:56 -0800 (PST) X-Google-Smtp-Source: APXvYqza/JUH7wm47B8MrP8b4Nj0lH1K8b0TlIl82M8Db8oD20iTOnQNFdHKm/oVcPOlD7Dxn6xa X-Received: by 2002:aa7:d6c8:: with SMTP id x8mr4689985edr.300.1574889896807; Wed, 27 Nov 2019 13:24:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574889896; cv=none; d=google.com; s=arc-20160816; b=eetb2j3eUk+hRNUAFkV3HKTeH3aS6hbS+yX3sMw5TQVep1s379V5MaLBxvgaYVDQYM vDSlZKURqPk+3z66Zq3pX/1nLVKssv3Qr8PnR7TGgzirqtsPOtQxCptR7SJwaAEaXnM+ jFCsAbyP+3l6a3EsUzDFkpZmZbCScDQA2NakleWMYxIikSfQhpGMxQm9j36dyWTk4Np2 ug18p55K/pNlEOIkV2DObR9S7I/6w1zFTYMgJFCEsrcOsRqN96xhxepOBptUDUzUBbBS PPy/e53uO5VFtbxWX4Pr5eZOs8flZU2kaDWM1HlhoxXWhoXfCUFFCjmlsoDKSXZ47xw2 iojQ== 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=NwvO8E80eHj5ByzOU3o4uie3I9Uo5oPNqGtWB9J1r3o=; b=BvyN1wgfpCw+kIm9Lb7I+LuS/Brd5Vl4R0NWuHpfuRwWpY/7S4fqowY/bvXjkrzN8o HgkgOol2qZIjCoGuAErM7r2ld1/uUyWlrFupzbWs/5qM03YzSTv+FpSSE5vyxVMBxvjx yVlmB9R9Mk5KDl+fJ4h4HK7KwDHTUk3a3Uq9zcfOyMfQ8DNT1/TkYP3tNy7wS8XedUqd OvotsrhZGQy4sjT62Xs0Hp4zbb7v63ivt0dwNcOsl1UzFy65xHnYAmyWR2THO/XuVgkt tQ7thCHchjJy/QNz+99sUdazJx2xB1kZ7hF7Ys3zOAMWlUJxv7mnJUraoH8fUZfZL3u6 9QZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=P16GRtQW; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a16si9652766ejs.215.2019.11.27.13.24.33; Wed, 27 Nov 2019 13:24:56 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=P16GRtQW; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732101AbfK0VGK (ORCPT + 99 others); Wed, 27 Nov 2019 16:06:10 -0500 Received: from mail.kernel.org ([198.145.29.99]:60002 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727440AbfK0VGE (ORCPT ); Wed, 27 Nov 2019 16:06:04 -0500 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 5E0332086A; Wed, 27 Nov 2019 21:06:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574888763; bh=fplUeAm3cYMRQPtLwx2S5Y4Mzzno+mFsrYPL27frXLs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P16GRtQWt0NaKtxQaeHt0rZS82qu/6PF7oB80+NfwtjWAMwvGZMJtYUx7u+q4/gxH XsIxnVRj0KGEEtu1k8ePUjpe+mssXaZHk85p+dahnFZxcixTkelVeKuaR0MWoBT56J yKQc2iJhKs3N4PYAAAMzHwAR8TTc2yHL2US9BSTk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, John Pittman , David Jeffery , Laurence Oberman , Song Liu Subject: [PATCH 4.19 260/306] md/raid10: prevent access of uninitialized resync_pages offset Date: Wed, 27 Nov 2019 21:31:50 +0100 Message-Id: <20191127203133.828677762@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191127203114.766709977@linuxfoundation.org> References: <20191127203114.766709977@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: John Pittman commit 45422b704db392a6d79d07ee3e3670b11048bd53 upstream. Due to unneeded multiplication in the out_free_pages portion of r10buf_pool_alloc(), when using a 3-copy raid10 layout, it is possible to access a resync_pages offset that has not been initialized. This access translates into a crash of the system within resync_free_pages() while passing a bad pointer to put_page(). Remove the multiplication, preventing access to the uninitialized area. Fixes: f0250618361db ("md: raid10: don't use bio's vec table to manage resync pages") Cc: stable@vger.kernel.org # 4.12+ Signed-off-by: John Pittman Suggested-by: David Jeffery Reviewed-by: Laurence Oberman Signed-off-by: Song Liu Signed-off-by: Greg Kroah-Hartman --- drivers/md/raid10.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c @@ -229,7 +229,7 @@ static void * r10buf_pool_alloc(gfp_t gf out_free_pages: while (--j >= 0) - resync_free_pages(&rps[j * 2]); + resync_free_pages(&rps[j]); j = 0; out_free_bio: