block: check for proper length of iov entries in blk_rq_map_user_iov()
authorJens Axboe <jaxboe@fusionio.com>
Fri, 29 Oct 2010 14:10:18 +0000 (08:10 -0600)
committerJens Axboe <jaxboe@fusionio.com>
Wed, 10 Nov 2010 13:40:42 +0000 (14:40 +0100)
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>
block/blk-map.c

index d4a586d8691ec5ed37311d1e3fc76aa0c310828f..5d5dbe47c2285ee7ccb5f3ca784f9cdb8cb6df3e 100644 (file)
@@ -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)