[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20060801072315.GH31908@suse.de>
Date: Tue, 1 Aug 2006 09:23:15 +0200
From: Jens Axboe <axboe@...e.de>
To: Herbert Xu <herbert@...dor.apana.org.au>
Cc: Andrew Morton <akpm@...l.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [BLOCK] bh: Ensure bh fits within a page
On Tue, Aug 01 2006, Herbert Xu wrote:
> Hi Andrew:
>
> [BLOCK] bh: Ensure bh fits within a page
>
> There is a bug in jbd with slab debugging enabled where it was submitting
> a bh obtained via jbd_rep_kmalloc which crossed a page boundary. A lot
> of time was spent on tracking this down because the symptoms were far off
> from where the problem was.
>
> This patch adds a sanity check to submit_bh so we can immediately spot
> anyone doing similar things in future.
>
> Signed-off-by: Herbert Xu <herbert@...dor.apana.org.au>
>
> While you're at it, could you fix that jbd bug for us :)
>
> Cheers,
> --
> Visit Openswan at http://www.openswan.org/
> Email: Herbert Xu ~{PmV>HI~} <herbert@...dor.apana.org.au>
> Home Page: http://gondor.apana.org.au/~herbert/
> PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
> --
> diff --git a/fs/buffer.c b/fs/buffer.c
> index 71649ef..b998f08 100644
> --- a/fs/buffer.c
> +++ b/fs/buffer.c
> @@ -2790,6 +2790,7 @@ int submit_bh(int rw, struct buffer_head
> BUG_ON(!buffer_locked(bh));
> BUG_ON(!buffer_mapped(bh));
> BUG_ON(!bh->b_end_io);
> + WARN_ON(bh_offset(bh) + bh->b_size > PAGE_SIZE);
That looks really dangerous, I'd prefer that to be a BUG_ON() as well to
prevent nastiness further down.
--
Jens Axboe
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists