Re: [PATCH] firmware: dmi_scan: Prevent dmi_num integer overflow

From: Jean Delvare
Date: Thu Mar 26 2015 - 09:15:18 EST


Hi Matt,

Le Thursday 26 March 2015 Ã 13:06 +0000, Matt Fleming a Ãcrit :
> On Fri, 20 Mar, at 09:59:47AM, Jean Delvare wrote:
> > dmi_num is a u16, dmi_len is a u32, so this construct:
> >
> > dmi_num = dmi_len / 4;
> >
> > would result in an integer overflow for a DMI table larger than
> > 256 kB. I've never see such a large table so far, but SMBIOS 3.0
> > makes it possible so maybe we'll see such tables in the future.
> >
> > So instead of faking a structure count when the entry point does
> > not provide it, adjust the loop condition in dmi_table() to properly
> > deal with the case where dmi_num is not set.
> >
> > Signed-off-by: Jean Delvare <jdelvare@xxxxxxx>
> > Cc: Matt Fleming <matt.fleming@xxxxxxxxx>
> > Cc: Ard Biesheuvel <ard.biesheuvel@xxxxxxxxxx>
> > Cc: Ivan Khoronzhuk <ivan.khoronzhuk@xxxxxxxxxx>
> > ---
> > drivers/firmware/dmi_scan.c | 22 +++++++---------------
> > 1 file changed, 7 insertions(+), 15 deletions(-)
>
> Jean, are you taking this through your tree?

I don't actually have a tree, so feel free to pick it.

Thanks,
--
Jean Delvare
SUSE L3 Support

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/