]> rtime.felk.cvut.cz Git - lisovros/linux_canprio.git/commitdiff
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)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 9 Dec 2010 21:31:55 +0000 (13:31 -0800)
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@vsecurity.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
block/blk-map.c

index ade0a08c9099afdc487916924c0fe6718185536d..267a57b770994eb150d12597a4c670a9a3c5a508 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)