ia64/xen-unstable

changeset 11937:d2ba4ac36168

[BLOCK] blkback: Fix first_sect check.

The blkback code checks first_sect by computing last_sect - first_sect
+ 1. If this is not positive then the request is
rejected. Unfortunately, the calculation is stored in an unsigned
integer before the check is made so negative values will not be
rejected.

This patch fixes this by explicitly comparing first_sect with
last_sect.

The blktap code is similar but it stores the difference in a signed
integer so it's okay.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
author kfraser@localhost.localdomain
date Mon Oct 23 10:05:32 2006 +0100 (2006-10-23)
parents f326ec66e514
children 637eace6d5c6
files linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c
line diff
     1.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c	Mon Oct 23 10:00:14 2006 +0100
     1.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c	Mon Oct 23 10:05:32 2006 +0100
     1.3 @@ -375,7 +375,7 @@ static void dispatch_rw_block_io(blkif_t
     1.4  			req->seg[i].first_sect + 1;
     1.5  
     1.6  		if ((req->seg[i].last_sect >= (PAGE_SIZE >> 9)) ||
     1.7 -		    (seg[i].nsec <= 0))
     1.8 +		    (req->seg[i].last_sect < req->seg[i].first_sect))
     1.9  			goto fail_response;
    1.10  		preq.nr_sects += seg[i].nsec;
    1.11