[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1457609953-24101-1-git-send-email-sudipm.mukherjee@gmail.com>
Date: Thu, 10 Mar 2016 17:09:13 +0530
From: Sudip Mukherjee <sudipm.mukherjee@...il.com>
To: Jens Axboe <axboe@...nel.dk>, Jens Axboe <axboe@...com>
Cc: linux-kernel@...r.kernel.org, linux-block@...r.kernel.org,
Sudip Mukherjee <sudipm.mukherjee@...il.com>
Subject: [PATCH] block: fix possible NULL dereference
We were checking for iter to be NULL after dereferencing it. Lets first
check it and then use it.
Signed-off-by: Sudip Mukherjee <sudip.mukherjee@...ethink.co.uk>
---
block/blk-map.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/block/blk-map.c b/block/blk-map.c
index a54f054..089ed59 100644
--- a/block/blk-map.c
+++ b/block/blk-map.c
@@ -126,7 +126,7 @@ int blk_rq_map_user_iov(struct request_queue *q, struct request *rq,
const struct iov_iter *iter, gfp_t gfp_mask)
{
struct iovec iov, prv = {.iov_base = NULL, .iov_len = 0};
- bool copy = (q->dma_pad_mask & iter->count) || map_data;
+ bool copy;
struct bio *bio = NULL;
struct iov_iter i;
int ret;
@@ -134,6 +134,7 @@ int blk_rq_map_user_iov(struct request_queue *q, struct request *rq,
if (!iter || !iter->count)
return -EINVAL;
+ copy = (q->dma_pad_mask & iter->count) || map_data;
iov_for_each(iov, i, *iter) {
unsigned long uaddr = (unsigned long) iov.iov_base;
--
1.9.1
Powered by blists - more mailing lists