aboutsummaryrefslogtreecommitdiffstats
path: root/block/blk-map.c
diff options
context:
space:
mode:
Diffstat (limited to 'block/blk-map.c')
-rw-r--r--block/blk-map.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/block/blk-map.c b/block/blk-map.c
index 0b1af5a3537c..ddd96fb11a7d 100644
--- a/block/blk-map.c
+++ b/block/blk-map.c
@@ -210,6 +210,7 @@ int blk_rq_map_user_iov(struct request_queue *q, struct request *rq,
210 if (!bio_flagged(bio, BIO_USER_MAPPED)) 210 if (!bio_flagged(bio, BIO_USER_MAPPED))
211 rq->cmd_flags |= REQ_COPY_USER; 211 rq->cmd_flags |= REQ_COPY_USER;
212 212
213 blk_queue_bounce(q, &bio);
213 bio_get(bio); 214 bio_get(bio);
214 blk_rq_bio_prep(q, rq, bio); 215 blk_rq_bio_prep(q, rq, bio);
215 rq->buffer = rq->data = NULL; 216 rq->buffer = rq->data = NULL;
@@ -268,6 +269,7 @@ int blk_rq_map_kern(struct request_queue *q, struct request *rq, void *kbuf,
268 int reading = rq_data_dir(rq) == READ; 269 int reading = rq_data_dir(rq) == READ;
269 int do_copy = 0; 270 int do_copy = 0;
270 struct bio *bio; 271 struct bio *bio;
272 unsigned long stack_mask = ~(THREAD_SIZE - 1);
271 273
272 if (len > (q->max_hw_sectors << 9)) 274 if (len > (q->max_hw_sectors << 9))
273 return -EINVAL; 275 return -EINVAL;
@@ -278,6 +280,10 @@ int blk_rq_map_kern(struct request_queue *q, struct request *rq, void *kbuf,
278 alignment = queue_dma_alignment(q) | q->dma_pad_mask; 280 alignment = queue_dma_alignment(q) | q->dma_pad_mask;
279 do_copy = ((kaddr & alignment) || (len & alignment)); 281 do_copy = ((kaddr & alignment) || (len & alignment));
280 282
283 if (!((kaddr & stack_mask) ^
284 ((unsigned long)current->stack & stack_mask)))
285 do_copy = 1;
286
281 if (do_copy) 287 if (do_copy)
282 bio = bio_copy_kern(q, kbuf, len, gfp_mask, reading); 288 bio = bio_copy_kern(q, kbuf, len, gfp_mask, reading);
283 else 289 else