All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] firmware: dmi_scan: Fix UUID length safety check
@ 2018-04-09 12:51 Jean Delvare
  2018-04-10  7:19 ` Mika Westerberg
  0 siblings, 1 reply; 2+ messages in thread
From: Jean Delvare @ 2018-04-09 12:51 UTC (permalink / raw)
  To: LKML
  Cc: Mika Westerberg, Sasha Levin, Dmitry Torokhov, Andy Shevchenko,
	Linus Walleij

The test which ensures that the DMI type 1 structure is long enough
to hold the UUID is off by one. It would fail if the structure is
exactly 24 bytes long, while that's sufficient to hold the UUID.

I don't expect this bug to cause problem in practice because all
implementations I have seen had length 8, 25 or 27 bytes, in line
with the SMBIOS specifications. But let's fix it still.

Signed-off-by: Jean Delvare <jdelvare@suse.de>
Fixes: a814c3597a6b ("firmware: dmi_scan: Check DMI structure length")
Cc: Mika Westerberg <mika.westerberg@linux.intel.com>
---
 drivers/firmware/dmi_scan.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- linux-4.16.orig/drivers/firmware/dmi_scan.c	2018-04-08 09:32:20.508719012 +0200
+++ linux-4.16/drivers/firmware/dmi_scan.c	2018-04-09 11:24:57.937044642 +0200
@@ -186,7 +186,7 @@ static void __init dmi_save_uuid(const s
 	char *s;
 	int is_ff = 1, is_00 = 1, i;
 
-	if (dmi_ident[slot] || dm->length <= index + 16)
+	if (dmi_ident[slot] || dm->length < index + 16)
 		return;
 
 	d = (u8 *) dm + index;


-- 
Jean Delvare
SUSE L3 Support

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] firmware: dmi_scan: Fix UUID length safety check
  2018-04-09 12:51 [PATCH] firmware: dmi_scan: Fix UUID length safety check Jean Delvare
@ 2018-04-10  7:19 ` Mika Westerberg
  0 siblings, 0 replies; 2+ messages in thread
From: Mika Westerberg @ 2018-04-10  7:19 UTC (permalink / raw)
  To: Jean Delvare
  Cc: LKML, Sasha Levin, Dmitry Torokhov, Andy Shevchenko, Linus Walleij

On Mon, Apr 09, 2018 at 02:51:43PM +0200, Jean Delvare wrote:
> The test which ensures that the DMI type 1 structure is long enough
> to hold the UUID is off by one. It would fail if the structure is
> exactly 24 bytes long, while that's sufficient to hold the UUID.
> 
> I don't expect this bug to cause problem in practice because all
> implementations I have seen had length 8, 25 or 27 bytes, in line
> with the SMBIOS specifications. But let's fix it still.
> 
> Signed-off-by: Jean Delvare <jdelvare@suse.de>
> Fixes: a814c3597a6b ("firmware: dmi_scan: Check DMI structure length")
> Cc: Mika Westerberg <mika.westerberg@linux.intel.com>

Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-04-10  7:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-09 12:51 [PATCH] firmware: dmi_scan: Fix UUID length safety check Jean Delvare
2018-04-10  7:19 ` Mika Westerberg

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.