diff options
author | NeilBrown <neilb@suse.de> | 2006-01-06 09:20:40 +0100 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-06 17:34:07 +0100 |
commit | 1345b1d8adbdeceb1c871d9a4af5e2a700b341c6 (patch) | |
tree | 0da1db7d273752ad5281db415e9245f3f3a63383 /drivers/md/raid1.c | |
parent | [PATCH] md: remove inappropriate limits in md/bitmap configuration. (diff) | |
download | linux-1345b1d8adbdeceb1c871d9a4af5e2a700b341c6.tar.xz linux-1345b1d8adbdeceb1c871d9a4af5e2a700b341c6.zip |
[PATCH] md: define and use safe_put_page for md
md sometimes call put_page on NULL pointers (treating it like kfree). This is
not safe, so define and use a 'safe_put_page' which checks for NULL.
Signed-off-by: Neil Brown <neilb@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/md/raid1.c')
-rw-r--r-- | drivers/md/raid1.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 39c10a65683d..feea4eeca1d9 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c @@ -136,7 +136,7 @@ static void * r1buf_pool_alloc(gfp_t gfp_flags, void *data) out_free_pages: for (i=0; i < RESYNC_PAGES ; i++) for (j=0 ; j < pi->raid_disks; j++) - put_page(r1_bio->bios[j]->bi_io_vec[i].bv_page); + safe_put_page(r1_bio->bios[j]->bi_io_vec[i].bv_page); j = -1; out_free_bio: while ( ++j < pi->raid_disks ) @@ -156,7 +156,7 @@ static void r1buf_pool_free(void *__r1_bio, void *data) if (j == 0 || r1bio->bios[j]->bi_io_vec[i].bv_page != r1bio->bios[0]->bi_io_vec[i].bv_page) - put_page(r1bio->bios[j]->bi_io_vec[i].bv_page); + safe_put_page(r1bio->bios[j]->bi_io_vec[i].bv_page); } for (i=0 ; i < pi->raid_disks; i++) bio_put(r1bio->bios[i]); @@ -381,7 +381,7 @@ static int raid1_end_write_request(struct bio *bio, unsigned int bytes_done, int /* free extra copy of the data pages */ int i = bio->bi_vcnt; while (i--) - put_page(bio->bi_io_vec[i].bv_page); + safe_put_page(bio->bi_io_vec[i].bv_page); } /* clear the bitmap if all writes complete successfully */ bitmap_endwrite(r1_bio->mddev->bitmap, r1_bio->sector, @@ -1907,7 +1907,7 @@ out_free_conf: if (conf->r1bio_pool) mempool_destroy(conf->r1bio_pool); kfree(conf->mirrors); - put_page(conf->tmppage); + safe_put_page(conf->tmppage); kfree(conf->poolinfo); kfree(conf); mddev->private = NULL; |