[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120710155226.GH1894@decadent.org.uk>
Date: Tue, 10 Jul 2012 16:52:26 +0100
From: Ben Hutchings <ben@...adent.org.uk>
To: linux-kernel@...r.kernel.org, stable@...r.kernel.org
Cc: torvalds@...ux-foundation.org, akpm@...ux-foundation.org,
alan@...rguk.ukuu.org.uk, Jan Kara <jack@...e.cz>
Subject: Re: [ 26/48] udf: Avoid run away loop when partition table length
is corrupted
On Mon, Jul 09, 2012 at 03:31:42PM +0100, Ben Hutchings wrote:
> 3.2-stable review patch. If anyone has any objections, please let me know.
>
> ------------------
>
> From: Jan Kara <jack@...e.cz>
>
> commit adee11b2085bee90bd8f4f52123ffb07882d6256 upstream.
>
> Check provided length of partition table so that (possibly maliciously)
> corrupted partition table cannot cause accessing data beyond current buffer.
>
> Signed-off-by: Jan Kara <jack@...e.cz>
> Signed-off-by: Ben Hutchings <ben@...adent.org.uk>
> ---
> fs/udf/super.c | 10 +++++++++-
> 1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/fs/udf/super.c b/fs/udf/super.c
> index 9da6f4e..ce911f5 100644
> --- a/fs/udf/super.c
> +++ b/fs/udf/super.c
[...]
> @@ -1232,13 +1233,20 @@ static int udf_load_logicalvol(struct super_block *sb, sector_t block,
> return 1;
> BUG_ON(ident != TAG_IDENT_LVD);
> lvd = (struct logicalVolDesc *)bh->b_data;
> + table_len = le32_to_cpu(lvd->mapTableLength);
> + if (sizeof(*lvd) + table_len > sb->s_blocksize) {
[...]
I don't think this is sufficient, unless there has been some prior
validation of lvd->mapTableLength. On a 32-bit machine, the addition
may overflow. The untrusted value has to be validated before doing
any arithmetic on it, e.g.:
if (table_len > sb->s_blocksize - sizeof(*lv)) {
Ben.
--
Ben Hutchings
We get into the habit of living before acquiring the habit of thinking.
- Albert Camus
--
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