Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757815AbZDWHhU (ORCPT ); Thu, 23 Apr 2009 03:37:20 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753631AbZDWH3N (ORCPT ); Thu, 23 Apr 2009 03:29:13 -0400 Received: from sous-sol.org ([216.99.217.87]:48437 "EHLO x200.localdomain" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1756049AbZDWH3L (ORCPT ); Thu, 23 Apr 2009 03:29:11 -0400 Message-Id: <20090423072328.181381441@sous-sol.org> User-Agent: quilt/0.47-1 Date: Thu, 23 Apr 2009 00:20:44 -0700 From: Chris Wright To: linux-kernel@vger.kernel.org, stable@kernel.org, jejb@kernel.org Cc: Justin Forbes , Zwane Mwaikambo , "Theodore Ts'o" , Randy Dunlap , Dave Jones , Chuck Wolber , Chris Wedgwood , Michael Krufky , Chuck Ebbert , Domenico Andreoli , Willy Tarreau , Rodrigo Rubira Branco , Jake Edge , Eugene Teo , torvalds@linux-foundation.org, akpm@linux-foundation.org, alan@lxorguk.ukuu.org.uk, NeilBrown , "Jens Axboe" Subject: [patch 024/100] md/raid1 - dont assume newly allocated bvecs are initialised. References: <20090423072020.428683652@sous-sol.org> Content-Disposition: inline; filename=md-raid1-don-t-assume-newly-allocated-bvecs-are-initialised.patch Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1723 Lines: 53 -stable review patch. If anyone has any objections, please let us know. --------------------- From: NeilBrown upstream commit: 303a0e11d0ee136ad8f53f747f3c377daece763b Since commit d3f761104b097738932afcc310fbbbbfb007ef92 newly allocated bvecs aren't initialised to NULL, so we have to be more careful about freeing a bio which only managed to get a few pages allocated to it. Otherwise the resync process crashes. This patch is appropriate for 2.6.29-stable. Cc: stable@kernel.org Cc: "Jens Axboe" Reported-by: Gabriele Tozzi Signed-off-by: NeilBrown Signed-off-by: Chris Wright --- drivers/md/raid1.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c @@ -120,6 +120,7 @@ static void * r1buf_pool_alloc(gfp_t gfp goto out_free_pages; bio->bi_io_vec[i].bv_page = page; + bio->bi_vcnt = i+1; } } /* If not user-requests, copy the page pointers to all bios */ @@ -135,9 +136,9 @@ static void * r1buf_pool_alloc(gfp_t gfp return r1_bio; out_free_pages: - for (i=0; i < RESYNC_PAGES ; i++) - for (j=0 ; j < pi->raid_disks; j++) - safe_put_page(r1_bio->bios[j]->bi_io_vec[i].bv_page); + for (j=0 ; j < pi->raid_disks; j++) + for (i=0; i < r1_bio->bios[j]->bi_vcnt ; i++) + put_page(r1_bio->bios[j]->bi_io_vec[i].bv_page); j = -1; out_free_bio: while ( ++j < pi->raid_disks ) -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/