summaryrefslogtreecommitdiff
authorGreg Edwards <gedwards@ddn.com>2018-08-08 19:27:53 (GMT)
committer Greg Kroah-Hartman <gregkh@linuxfoundation.org>2018-09-15 07:42:59 (GMT)
commitbbab86e8918c7211d32f18de7e0bcb0c52403621 (patch)
tree62babc9c09f8a3088767d14a5130c9f26f8c6c26
parent6841830ae6e924a66bbe24d0e3c01a21ba4757d8 (diff)
downloadcommon-bbab86e8918c7211d32f18de7e0bcb0c52403621.zip
common-bbab86e8918c7211d32f18de7e0bcb0c52403621.tar.gz
common-bbab86e8918c7211d32f18de7e0bcb0c52403621.tar.bz2
block: bvec_nr_vecs() returns value for wrong slab
[ 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 <gedwards@ddn.com> Signed-off-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Sasha Levin <alexander.levin@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat
-rw-r--r--block/bio.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/block/bio.c b/block/bio.c
index 4f93345..68972e3 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -155,7 +155,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)