From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754403Ab1KMSz0 (ORCPT ); Sun, 13 Nov 2011 13:55:26 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:56432 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752696Ab1KMSzZ convert rfc822-to-8bit (ORCPT ); Sun, 13 Nov 2011 13:55:25 -0500 Message-ID: <1321210507.18929.293.camel@deadeye> Subject: [PATCH] block: Always check length of all iov entries in blk_rq_map_user_iov() From: Ben Hutchings To: Jens Axboe Cc: Xiaotian Feng , Dan Rosenberg , Dan Carpenter , LKML Date: Sun, 13 Nov 2011 18:55:07 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-Mailer: Evolution 3.0.3-2 Mime-Version: 1.0 X-SA-Exim-Connect-IP: 2001:470:1f08:1539:21c:bfff:fe03:f805 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Even after commit 5478755616ae2ef1ce144dded589b62b2a50d575 ("block: check for proper length of iov entries earlier ...") we still won't check for zero-length entries after an unaligned entry. Remove the break-statement, so all entries are checked. Signed-off-by: Ben Hutchings Cc: stable@vger.kernel.org --- block/blk-map.c | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-) diff --git a/block/blk-map.c b/block/blk-map.c index e663ac2..2e852a4 100644 --- a/block/blk-map.c +++ b/block/blk-map.c @@ -204,10 +204,8 @@ int blk_rq_map_user_iov(struct request_queue *q, struct request *rq, if (!iov[i].iov_len) return -EINVAL; - if (uaddr & queue_dma_alignment(q)) { + if (uaddr & queue_dma_alignment(q)) unaligned = 1; - break; - } } if (unaligned || (q->dma_pad_mask & len) || map_data) -- 1.7.7.2