From: Jens Axboe Date: Fri, 29 Oct 2010 14:10:18 +0000 (-0600) Subject: block: check for proper length of iov entries in blk_rq_map_user_iov() X-Git-Tag: v2.6.35.10~214 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=e978df456e01ff5412c29e6fef5dd47960867476;p=karo-tx-linux.git block: check for proper length of iov entries in blk_rq_map_user_iov() commit 9284bcf4e335e5f18a8bc7b26461c33ab60d0689 upstream. Ensure that we pass down properly validated iov segments before calling into the mapping or copy functions. Reported-by: Dan Rosenberg Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman Signed-off-by: Andi Kleen --- diff --git a/block/blk-map.c b/block/blk-map.c index 9083cf0180cc..30a7e5158930 100644 --- a/block/blk-map.c +++ b/block/blk-map.c @@ -205,6 +205,8 @@ int blk_rq_map_user_iov(struct request_queue *q, struct request *rq, unaligned = 1; break; } + if (!iov[i].iov_len) + return -EINVAL; } if (unaligned || (q->dma_pad_mask & len) || map_data)