Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 98913
b: refs/heads/master
c: 30c00ed
h: refs/heads/master
i:
  98911: 9d92f3f
v: v3
  • Loading branch information
FUJITA Tomonori authored and Jens Axboe committed Jul 4, 2008
1 parent 19facdf commit 0676c0d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 27f8221af406e43b529a5425bc99c9b1e9bdf521
refs/heads/master: 30c00eda73d5db5bd64dd0c370161abd8df5ba4a
5 changes: 5 additions & 0 deletions trunk/block/blk-map.c
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ int blk_rq_map_kern(struct request_queue *q, struct request *rq, void *kbuf,
int reading = rq_data_dir(rq) == READ;
int do_copy = 0;
struct bio *bio;
unsigned long stack_mask = ~(THREAD_SIZE - 1);

if (len > (q->max_hw_sectors << 9))
return -EINVAL;
Expand All @@ -279,6 +280,10 @@ int blk_rq_map_kern(struct request_queue *q, struct request *rq, void *kbuf,
alignment = queue_dma_alignment(q) | q->dma_pad_mask;
do_copy = ((kaddr & alignment) || (len & alignment));

if (!((kaddr & stack_mask) ^
((unsigned long)current->stack & stack_mask)))
do_copy = 1;

if (do_copy)
bio = bio_copy_kern(q, kbuf, len, gfp_mask, reading);
else
Expand Down

0 comments on commit 0676c0d

Please sign in to comment.