Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp719451imm; Thu, 13 Sep 2018 06:47:45 -0700 (PDT) X-Google-Smtp-Source: ANB0VdY3Y/vju5H7W9FpI4wc7uaWl8zLahSir3vNy1MMeB7sfFr6111MOgh/mjRnU8KBuaAXdApx X-Received: by 2002:a17:902:8541:: with SMTP id d1-v6mr7516981plo.81.1536846465752; Thu, 13 Sep 2018 06:47:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536846465; cv=none; d=google.com; s=arc-20160816; b=y7SvNkoRM/zHCwAUkjxK4FBoyu5czbm3agtIFBwU+nwMZzsbK2WLrAfM1gTiA4h0V7 ijjwAXnsfATP6TWkWy4m+Z9eOGCQD4iJygl+p0SHxkAZ1IXyyO9PTNwBA5Fi/HfxGsj3 w+T292w9ypVE1EdZPh5n+EP8XzQ0kPqG6JDntOWNwjF+nXFfPaxxrKwSgkHS3F4QMQ4G ZsjcQ+bSp470jKj+SF4D2ZpSm1SdlX+76cLRJDKSjnHF0j3DDvZUqRbNLLMV225jjd/1 KRVml5ht7p8OzV5acmTZTCN2FjciIdgnxlqHWeRiOoJpbnvgQlXl4ybejMbLuVXyN8R1 GK3g== 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; bh=A5RcBI8pMWuaCJHpx9X3/6hnVWpjuqBKyGoTk7PHW7U=; b=FQdABfv+Jp2UM9eSxfboUgyzg8y+Rnvn7JtX4apuZIv/ArkhC6Z1vRMDyouT9XkMoS g13SrHW53i7aCrRPPQcc+4cgucQGP0potJfzAaoomfBYq3z6/oxQqOv6Ty7mTddmmv3g NFbNcnUdHeH2BlIUy6cJBULxn+xwEv/TWYb2n+9jUyIlVhSflISfE6Xvh5fM8gInfwfh L+81j9DSXp/y/Pbn9o0FAClzOS1Umm/yZ6iZ9jJptD7IL9eYFtQ5G193cRE6FvYA+jGc t7DZoJtB7fSa+R5+ie1lXA3Hesuk7NxXYzbStFJhvLRWnmmiRebCP+34uIRlIcN1jcxY c0xg== 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 f10-v6si4333304pgk.367.2018.09.13.06.47.30; Thu, 13 Sep 2018 06:47:45 -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 S1730405AbeIMS4v (ORCPT + 99 others); Thu, 13 Sep 2018 14:56:51 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:32790 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729219AbeIMS4u (ORCPT ); Thu, 13 Sep 2018 14:56:50 -0400 Received: from localhost (ip-213-127-77-73.ip.prioritytelecom.net [213.127.77.73]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 733A9CFE; Thu, 13 Sep 2018 13:47:17 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Greg Edwards , Jens Axboe , Sasha Levin Subject: [PATCH 4.14 056/115] block: bvec_nr_vecs() returns value for wrong slab Date: Thu, 13 Sep 2018 15:31:16 +0200 Message-Id: <20180913131827.178534837@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180913131823.327472833@linuxfoundation.org> References: <20180913131823.327472833@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review 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: Greg Edwards [ Upstream commit d6c02a9beb67f13d5f14f23e72fa9981e8b84477 ] In commit ed996a52c868 ("block: simplify and cleanup bvec pool handling"), the value of the slab index is incremented by one in bvec_alloc() after the allocation is done to indicate an index value of 0 does not need to be later freed. bvec_nr_vecs() was not updated accordingly, and thus returns the wrong value. Decrement idx before performing the lookup. Fixes: ed996a52c868 ("block: simplify and cleanup bvec pool handling") Signed-off-by: Greg Edwards Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- block/bio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/block/bio.c +++ b/block/bio.c @@ -156,7 +156,7 @@ out: unsigned int bvec_nr_vecs(unsigned short idx) { - return bvec_slabs[idx].nr_vecs; + return bvec_slabs[--idx].nr_vecs; } void bvec_free(mempool_t *pool, struct bio_vec *bv, unsigned int idx)