Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 251235
b: refs/heads/master
c: e935049
h: refs/heads/master
i:
  251233: 33c92dc
  251231: 3493c5d
v: v3
  • Loading branch information
Konrad Rzeszutek Wilk committed Apr 18, 2011
1 parent bdc2381 commit 74fd568
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9f3aedf573dd034d59e7eb6c4ee97648d5be8fc6
refs/heads/master: e93504933ee6982bdc005fa5c24e1ea330faaf8b
17 changes: 11 additions & 6 deletions trunk/drivers/xen/blkback/blkback.c
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,7 @@ static void dispatch_rw_block_io(struct blkif_st *blkif,
pending_req->operation = req->operation;
pending_req->status = BLKIF_RSP_OKAY;
pending_req->nr_pages = nseg;

for (i = 0; i < nseg; i++) {
seg[i].nsec = req->u.rw.seg[i].last_sect -
req->u.rw.seg[i].first_sect + 1;
Expand All @@ -522,12 +523,6 @@ static void dispatch_rw_block_io(struct blkif_st *blkif,
goto fail_response;
preq.nr_sects += seg[i].nsec;

if (((int)preq.sector_number|(int)seg[i].nsec) &
((bdev_logical_block_size(preq.bdev) >> 9) - 1)) {
DPRINTK("Misaligned I/O request from domain %d",
blkif->domid);
goto fail_response;
}
}

if (vbd_translate(&preq, blkif, operation) != 0) {
Expand All @@ -537,6 +532,16 @@ static void dispatch_rw_block_io(struct blkif_st *blkif,
preq.sector_number + preq.nr_sects, preq.dev);
goto fail_response;
}
/* This check _MUST_ be done after vbd_translate as the preq.bdev
* is set there. */
for (i = 0; i < nseg; i++) {
if (((int)preq.sector_number|(int)seg[i].nsec) &
((bdev_logical_block_size(preq.bdev) >> 9) - 1)) {
DPRINTK("Misaligned I/O request from domain %d",
blkif->domid);
goto fail_response;
}
}
/* If we have failed at this point, we need to undo the M2P override,
* set gnttab_set_unmap_op on all of the grant references and perform
* the hypercall to unmap the grants - that is all done in
Expand Down

0 comments on commit 74fd568

Please sign in to comment.