block: check for proper length of iov entries in blk_rq_map_user_iov()

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

Reported-by: Dan Rosenberg <drosenberg@vsecurity.com>
Cc: stable@kernel.org
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
This commit is contained in:
Jens Axboe 2010-10-29 08:10:18 -06:00
parent 151f52f09c
commit 9284bcf4e3
1 changed files with 2 additions and 0 deletions

View File

@ -205,6 +205,8 @@ int blk_rq_map_user_iov(struct request_queue *q, struct request *rq,
unaligned = 1; unaligned = 1;
break; break;
} }
if (!iov[i].iov_len)
return -EINVAL;
} }
if (unaligned || (q->dma_pad_mask & len) || map_data) if (unaligned || (q->dma_pad_mask & len) || map_data)