* [PATCH] block: fix possible NULL dereference
@ 2016-03-10 11:39 Sudip Mukherjee
2016-03-10 12:03 ` Johannes Thumshirn
2016-03-10 15:44 ` Jens Axboe
0 siblings, 2 replies; 3+ messages in thread
From: Sudip Mukherjee @ 2016-03-10 11:39 UTC (permalink / raw)
To: Jens Axboe, Jens Axboe; +Cc: linux-kernel, linux-block, Sudip Mukherjee
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@codethink.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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] block: fix possible NULL dereference
2016-03-10 11:39 [PATCH] block: fix possible NULL dereference Sudip Mukherjee
@ 2016-03-10 12:03 ` Johannes Thumshirn
2016-03-10 15:44 ` Jens Axboe
1 sibling, 0 replies; 3+ messages in thread
From: Johannes Thumshirn @ 2016-03-10 12:03 UTC (permalink / raw)
To: Sudip Mukherjee; +Cc: Jens Axboe, Jens Axboe, linux-kernel, linux-block
On Thu, Mar 10, 2016 at 05:09:13PM +0530, Sudip Mukherjee wrote:
> 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@codethink.co.uk>
Good catch
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
--
Johannes Thumshirn Storage
jthumshirn@suse.de +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] block: fix possible NULL dereference
2016-03-10 11:39 [PATCH] block: fix possible NULL dereference Sudip Mukherjee
2016-03-10 12:03 ` Johannes Thumshirn
@ 2016-03-10 15:44 ` Jens Axboe
1 sibling, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2016-03-10 15:44 UTC (permalink / raw)
To: Sudip Mukherjee, Jens Axboe; +Cc: linux-kernel, linux-block
On 03/10/2016 04:39 AM, Sudip Mukherjee wrote:
> We were checking for iter to be NULL after dereferencing it. Lets first
> check it and then use it.
Nobody calls it with iter == NULL, I think we should just kill the !iter
check
--
Jens Axboe
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-03-10 15:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-10 11:39 [PATCH] block: fix possible NULL dereference Sudip Mukherjee
2016-03-10 12:03 ` Johannes Thumshirn
2016-03-10 15:44 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).