Re: [PATCH v2 1/3] dell-wmi: Stop storing pointers to DMI tables

From: Jean Delvare
Date: Tue Jan 19 2016 - 03:41:57 EST


Hi Andy,

On Mon, 18 Jan 2016 12:59:38 -0800, Andy Lutomirski wrote:
> The dmi_walk function maps the DMI table, walks it, and unmaps it.
> This means that the dell_bios_hotkey_table that find_hk_type stores
> points to unmapped memory by the time it gets read.
>
> I've been able to trigger crashes caused by the stale pointer a
> couple of times, but never on a stock kernel.
>
> Fix it by generating the keymap in the dmi_walk callback instead of
> storing a pointer.
>
> Signed-off-by: Andy Lutomirski <luto@xxxxxxxxxx>
> ---
>
> Notes:
> Changes from v1:
> - Rename handle_dmi_table to handle_dmi_entry (Jean)
> - Remove useless assignment to results->err (Jean)
>
> drivers/platform/x86/dell-wmi.c | 68 +++++++++++++++++++++++++----------------
> 1 file changed, 41 insertions(+), 27 deletions(-)
> (...)
> @@ -431,7 +446,6 @@ static int __init dell_wmi_init(void)
> return -ENODEV;
> }
>
> - dmi_walk(find_hk_type, NULL);
>

Please also delete the following blank line, to avoid two consecutive
blank lines.

> err = dell_wmi_input_setup();
> if (err)

Other than this, it looks good to me, so after fixing the above, you
can add:

Reviewed-by: Jean Delvare <jdelvare@xxxxxxx>

--
Jean Delvare
SUSE L3 Support