summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2018-07-04 12:59:58 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-09-09 10:32:38 +0200
commitf7169718defcf81ba5b6f32b1a324b0e3ad68b28 (patch)
tree4a509d8256be98c6120f98b4cf6b560991c24ba3
parent6ee996baf1ab28ae2f5f74f1f62e3bc488cc8f6a (diff)
downloadlinux-stable-f7169718defcf81ba5b6f32b1a324b0e3ad68b28.tar.gz
linux-stable-f7169718defcf81ba5b6f32b1a324b0e3ad68b28.tar.bz2
linux-stable-f7169718defcf81ba5b6f32b1a324b0e3ad68b28.zip
pnfs/blocklayout: off by one in bl_map_stripe()
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 <dan.carpenter@oracle.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Cc: stable@vger.kernel.org # 3.17+ Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--fs/nfs/blocklayout/dev.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/nfs/blocklayout/dev.c b/fs/nfs/blocklayout/dev.c
index a7efd83779d2..dec5880ac6de 100644
--- a/fs/nfs/blocklayout/dev.c
+++ b/fs/nfs/blocklayout/dev.c
@@ -204,7 +204,7 @@ static bool bl_map_stripe(struct pnfs_block_dev *dev, u64 offset,
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 */