Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp268360img; Mon, 18 Mar 2019 02:41:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqzK7A1TN0C6+dvaMiI1QNqtJZTLQDcS1d9wZ1I2rjcYdWmrPI2HQDPEPL9DjILxAENXAtMY X-Received: by 2002:aa7:8a95:: with SMTP id a21mr18134181pfc.14.1552902110370; Mon, 18 Mar 2019 02:41:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552902110; cv=none; d=google.com; s=arc-20160816; b=VtvfPeQlWRPEzDphxncXcj9BMhstIg45AmIXFmPSr8YGaYIefYfq6Oehu13Sb+0BMq 3Js1IqbW55KkxUrEw9k5fJJJa3yF1mKhhyVO/UeaOUG4kyvKeCJLmPiSqu/+C0HH0buU vDKTK23d82lnv46GIE1Yq6M/cjOfjPh23dpLd8KKNQPYPNnjAByhDLFqebBac4YVYg3R bMCR2CF6GRrBfBVOFzmslzbdavrvhuWdpifjpFg77PuEP1ZemzgCjTWUuGun55KPAyiB PKvpQ+3k6rboejA0jWfY2+JWZhE2FyUUb5Hw1JZkipu1GXDM4DyOGJzDY4ItdfovzVeH pukw== 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=tT8n0DfF7OAmwUm932NKoOzpk5m+3OGOu9HINWzl9mY=; b=OS6jdLj4CV5jkzONZkoVs0X/Z+h1NSYVLadSuPos6XbbDpggl9FeTDoL/XmS+Yr6Xx qdf+TLZ8jRt8BKRaoeN+2X+6kpjQYgiQPIx267iMr1pH6II3sbl2IaTfBIIToasg2moZ M8WiqcqX8J2HQRbA2n1+bJ6raV3bUGaRQ+Tg/AUXrS4hWfnq0x9Dcm3uEJLu5/n6/ADV bXhZsQYLdNRI8lwMS5bOisGK14qoN20bRwy6SoHoV2dKL9j5x/NqB0N6US7Y4bnjUWsW IOw4lGbtt84dzG+2as0c6FBe/u+IrFPA4Z1wISLgNavyY7QbaO7L0TQ/TwZ3KidlDqJ2 ACpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="F7mb/fIM"; 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 b5si2103643pgk.237.2019.03.18.02.41.35; Mon, 18 Mar 2019 02:41:50 -0700 (PDT) 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="F7mb/fIM"; 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 S2387504AbfCRJfn (ORCPT + 99 others); Mon, 18 Mar 2019 05:35:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:44090 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387491AbfCRJfk (ORCPT ); Mon, 18 Mar 2019 05:35:40 -0400 Received: from localhost (5356596B.cm-6-7b.dynamic.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 C065E2083D; Mon, 18 Mar 2019 09:35:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1552901740; bh=PTkR6rjIKZyOydKnpO3uAJsIsZgyYpz3EDbKqOVVfR4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F7mb/fIMJ4sXManHI9hLpPTX5PLyj+XDDYGnHWvJR/qrplYneTSnUBc33jM2sVzQZ bD9kiGF8QYCHVjdGZ26f8KdIKNbo8J5JA3kjsmsuYicq4CpLSdz7prndZf7Z9PhHba xr8rdPrIZsBA0C6R2iQHHOhf0yKV8IvU84s+lBxQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xiao Ni , Song Liu Subject: [PATCH 4.14 33/34] Its wrong to add len to sector_nr in raid10 reshape twice Date: Mon, 18 Mar 2019 10:25:57 +0100 Message-Id: <20190318084149.634296540@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190318084144.657740413@linuxfoundation.org> References: <20190318084144.657740413@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore 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 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Xiao Ni commit b761dcf1217760a42f7897c31dcb649f59b2333e upstream. In reshape_request it already adds len to sector_nr already. It's wrong to add len to sector_nr again after adding pages to bio. If there is bad block it can't copy one chunk at a time, it needs to goto read_more. Now the sector_nr is wrong. It can cause data corruption. Cc: stable@vger.kernel.org # v3.16+ Signed-off-by: Xiao Ni Signed-off-by: Song Liu Signed-off-by: Greg Kroah-Hartman --- drivers/md/raid10.c | 1 - 1 file changed, 1 deletion(-) --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c @@ -4495,7 +4495,6 @@ read_more: atomic_inc(&r10_bio->remaining); read_bio->bi_next = NULL; generic_make_request(read_bio); - sector_nr += nr_sectors; sectors_done += nr_sectors; if (sector_nr <= last) goto read_more;