Commit c681eba4 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] raid1: fix oops in bio_put()

From: Neil Brown <neilb@cse.unsw.edu.au>

Fix an off-by-one in the r1buf_pool_alloc() ENOMEM error recovery path.
parent 4fc40b02
...@@ -104,8 +104,8 @@ static void * r1buf_pool_alloc(int gfp_flags, void *data) ...@@ -104,8 +104,8 @@ static void * r1buf_pool_alloc(int gfp_flags, void *data)
for ( ; i > 0 ; i--) for ( ; i > 0 ; i--)
__free_page(bio->bi_io_vec[i-1].bv_page); __free_page(bio->bi_io_vec[i-1].bv_page);
out_free_bio: out_free_bio:
while ( j < conf->raid_disks ) while ( ++j < conf->raid_disks )
bio_put(r1_bio->bios[++j]); bio_put(r1_bio->bios[j]);
r1bio_pool_free(r1_bio, conf->mddev); r1bio_pool_free(r1_bio, conf->mddev);
return NULL; return NULL;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment