[PATCH] [5/223] block: check for proper length of iov entries in blk_rq_map_user_iov()

From: Andi Kleen
Date: Sun Dec 12 2010 - 19:31:10 EST


2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Jens Axboe <jaxboe@xxxxxxxxxxxx>

commit 9284bcf4e335e5f18a8bc7b26461c33ab60d0689 upstream.

Ensure that we pass down properly validated iov segments before
calling into the mapping or copy functions.

Reported-by: Dan Rosenberg <drosenberg@xxxxxxxxxxxxx>
Signed-off-by: Jens Axboe <jaxboe@xxxxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxx>
Signed-off-by: Andi Kleen <ak@xxxxxxxxxxxxxxx>

---
block/blk-map.c | 2 ++
1 file changed, 2 insertions(+)

Index: linux/block/blk-map.c
===================================================================
--- linux.orig/block/blk-map.c
+++ linux/block/blk-map.c
@@ -205,6 +205,8 @@ int blk_rq_map_user_iov(struct request_q
unaligned = 1;
break;
}
+ if (!iov[i].iov_len)
+ return -EINVAL;
}

if (unaligned || (q->dma_pad_mask & len) || map_data)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/