Re: memcpy_fromio in dmi_scan.c

From: Jean Delvare
Date: Mon Jul 08 2013 - 09:54:59 EST


Hi Andrew,

Sorry for the late reply.

Le Thursday 25 April 2013 Ã 13:37 -0700, Andrew Morton a Ãcrit :
> So what's the fix? This?
>
> --- a/drivers/firmware/dmi_scan.c~a
> +++ a/drivers/firmware/dmi_scan.c
> @@ -500,9 +500,12 @@ void __init dmi_scan_machine(void)
> goto error;
>
> for (q = p; q < p + 0x10000; q += 16) {
> - if (memcmp(q, "_SM_", 4) == 0 && q - p <= 0xFFE0)
> + char buf[5];
> +
> + memcpy_from_io(buf, q, 5);
> + if (memcmp(buf, "_SM_", 4) == 0 && q - p <= 0xFFE0)
> rc = smbios_present(q);
> - else if (memcmp(q, "_DMI_", 5) == 0)
> + else if (memcmp(buf, "_DMI_", 5) == 0)
> rc = dmi_present(q);
> else
> continue;

That would have been it, yes, but meanwhile Ben Hutchings reworked the
whole thing and that fixed the problem I reported as a side effect:

https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/drivers/firmware/dmi_scan.c?id=79bae42d51a5d498500c890c19ef76df41d2bf59

I'd suggest leaving the stable kernels alone until someone complains, as
there doesn't seem to be any issue in practice (the only machines where
it would possibly matter are already hopelessly broken.)

All I can say is that these dmi_scan patches should never have made it
to stable kernels in the first place, as they infringed several rules
stable patches are supposed to comply with.

--
Jean Delvare
Suse L3

--
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/