ia64/linux-2.6.18-xen.hg

changeset 744:5012c470f875

blkback, blktap: Fix potential resource leak.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Wed Nov 26 11:10:33 2008 +0000 (2008-11-26)
parents f236d7def994
children 0b859c9516ba
files drivers/xen/blkback/blkback.c drivers/xen/blktap/blktap.c
line diff
     1.1 --- a/drivers/xen/blkback/blkback.c	Tue Nov 25 11:22:04 2008 +0000
     1.2 +++ b/drivers/xen/blkback/blkback.c	Wed Nov 26 11:10:33 2008 +0000
     1.3 @@ -317,14 +317,14 @@ static int do_block_io_op(blkif_t *blkif
     1.4  		if (RING_REQUEST_CONS_OVERFLOW(&blk_rings->common, rc))
     1.5  			break;
     1.6  
     1.7 -		pending_req = alloc_req();
     1.8 -		if (NULL == pending_req) {
     1.9 -			blkif->st_oo_req++;
    1.10 +		if (kthread_should_stop()) {
    1.11  			more_to_do = 1;
    1.12  			break;
    1.13  		}
    1.14  
    1.15 -		if (kthread_should_stop()) {
    1.16 +		pending_req = alloc_req();
    1.17 +		if (NULL == pending_req) {
    1.18 +			blkif->st_oo_req++;
    1.19  			more_to_do = 1;
    1.20  			break;
    1.21  		}
     2.1 --- a/drivers/xen/blktap/blktap.c	Tue Nov 25 11:22:04 2008 +0000
     2.2 +++ b/drivers/xen/blktap/blktap.c	Wed Nov 26 11:10:33 2008 +0000
     2.3 @@ -1286,14 +1286,14 @@ static int do_block_io_op(blkif_t *blkif
     2.4  			break;		
     2.5  		}
     2.6  
     2.7 -		pending_req = alloc_req();
     2.8 -		if (NULL == pending_req) {
     2.9 -			blkif->st_oo_req++;
    2.10 +		if (kthread_should_stop()) {
    2.11  			more_to_do = 1;
    2.12  			break;
    2.13  		}
    2.14  
    2.15 -		if (kthread_should_stop()) {
    2.16 +		pending_req = alloc_req();
    2.17 +		if (NULL == pending_req) {
    2.18 +			blkif->st_oo_req++;
    2.19  			more_to_do = 1;
    2.20  			break;
    2.21  		}