Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2327700imm; Fri, 7 Sep 2018 14:44:40 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbNhjefcB4WjwQWeXqcPbeNpPl6aWtySKHU+yNiNbQjXqrgRSiSNJckL++/PgrpnQ6vssAi X-Received: by 2002:a63:f344:: with SMTP id t4-v6mr10506370pgj.428.1536356680394; Fri, 07 Sep 2018 14:44:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536356680; cv=none; d=google.com; s=arc-20160816; b=io+I6OGTIV1LO5qSrSUlOGHqx8kPTWG81C4HvoJSGAGtYAoRwp1jHjf9RSF0g34ocg T+Je6E/A8t4IvCGiZX23mdqDaOip/cfk/kMkqTLaTOcLb7ZFErXQoj9Dk9b3NFRJHmQv NS9ENtWEAecKswCMYvMaysOfvHkQn3rGfQzQr4KzJcG/bYFuB8CwR6B1iFsD1QIuzjof 4BpdLg04cBF4zbCq37eANrJxxYsuToqdFG2EtM4Jzj4aH1nRzpBT1eERrqbUExw4dLvA zfLu0AOQMUTWTwnjxw7M7vWvfWAqjFuSajIYCu1GDYX4H4dwSalk/goQt2y7KfQ1GHj+ LnLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from; bh=BglEoahhEicgkHsG0dTJWCuZ32Zyn0JwfBWfT0Pq87Y=; b=WcoUoAw2TVJSLtaXyxqQHpsJ1F1iFLKFrMOLQrKKGxBc1ymt633HR0Y+qy/kzzpfHJ aqVd8Qn0z8p4HoCwjtLAaCO9ze58XtOTVc1C3yhGt272CGp5EmL27R9EPWQEc+WBp5AA FwpRUGyhSisehCVpZxYaA0P/iVqulLNzgatK6okE2zi7RqFsija9J25tYIJ1sRIvuByx VWGCQvGVARmoPzYS6CJH3kh/Dopl3k5GUQ17gw9KaHWsQf3ywyqCt3Ce8RdANqWegYDq JWbK/fm6iAYFmCtZMriINJwAGTqp1bAl1g5A8fe2cwCs2+Fy/xbDaboVimyjx4SJQcRS 9Mng== ARC-Authentication-Results: i=1; mx.google.com; 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 t7-v6si9640191pgh.307.2018.09.07.14.44.25; Fri, 07 Sep 2018 14:44:40 -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; 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 S1730841AbeIHC0O (ORCPT + 99 others); Fri, 7 Sep 2018 22:26:14 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:56872 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729347AbeIHC0O (ORCPT ); Fri, 7 Sep 2018 22:26:14 -0400 Received: from localhost (ip-213-127-74-90.ip.prioritytelecom.net [213.127.74.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id B9150BBF; Fri, 7 Sep 2018 21:43:18 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Christoph Hellwig , Anna Schumaker Subject: [PATCH 3.18 15/29] pnfs/blocklayout: off by one in bl_map_stripe() Date: Fri, 7 Sep 2018 23:10:36 +0200 Message-Id: <20180907210910.657928775@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180907210909.523240901@linuxfoundation.org> References: <20180907210909.523240901@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Dan Carpenter commit 0914bb965e38a055e9245637aed117efbe976e91 upstream. "dev->nr_children" is the number of children which were parsed successfully in bl_parse_stripe(). It could be all of them and then, in that case, it is equal to v->stripe.volumes_count. Either way, the > should be >= so that we don't go beyond the end of what we're supposed to. Fixes: 5c83746a0cf2 ("pnfs/blocklayout: in-kernel GETDEVICEINFO XDR parsing") Signed-off-by: Dan Carpenter Reviewed-by: Christoph Hellwig Cc: stable@vger.kernel.org # 3.17+ Signed-off-by: Anna Schumaker Signed-off-by: Greg Kroah-Hartman --- fs/nfs/blocklayout/dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/nfs/blocklayout/dev.c +++ b/fs/nfs/blocklayout/dev.c @@ -157,7 +157,7 @@ static bool bl_map_stripe(struct pnfs_bl chunk = div_u64(offset, dev->chunk_size); div_u64_rem(chunk, dev->nr_children, &chunk_idx); - if (chunk_idx > dev->nr_children) { + if (chunk_idx >= dev->nr_children) { dprintk("%s: invalid chunk idx %d (%lld/%lld)\n", __func__, chunk_idx, offset, dev->chunk_size); /* error, should not happen */