block: bvec_nr_vecs() returns value for wrong slab
authorGreg Edwards <gedwards@ddn.com>
Wed, 8 Aug 2018 19:27:53 +0000 (13:27 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 15 Sep 2018 07:45:30 +0000 (09:45 +0200)
commitd67c7c9dd14f3f6d6743d802ef017f14ddc73d3a
tree02917534274457799213b54a2814579d7dab4a23
parent6952b4ed9e4229485dde7b52d5511cc16e2c0df8
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>
block/bio.c