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

login
register
mail settings
Submitter Xiaotian Feng
Date Nov. 29, 2010, 9 a.m.
Message ID <1291021255-2838-1-git-send-email-dfeng@redhat.com>
Download mbox | patch
Permalink /patch/363282/
State New, archived
Headers show

Comments

Patch

diff --git a/block/blk-map.c b/block/blk-map.c
index 5d5dbe4..e663ac2 100644
--- a/block/blk-map.c
+++ b/block/blk-map.c
@@ -201,12 +201,13 @@  int blk_rq_map_user_iov(struct request_queue *q, struct request *rq,
 	for (i = 0; i < iov_count; i++) {
 		unsigned long uaddr = (unsigned long)iov[i].iov_base;
 
+		if (!iov[i].iov_len)
+			return -EINVAL;
+
 		if (uaddr & queue_dma_alignment(q)) {
 			unaligned = 1;
 			break;
 		}
-		if (!iov[i].iov_len)
-			return -EINVAL;
 	}
 
 	if (unaligned || (q->dma_pad_mask & len) || map_data)