]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/2.6.32.3/usb-emi62-fix-crash-when-trying-to-load-emi-6-2-firmware.patch
4.14-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 2.6.32.3 / usb-emi62-fix-crash-when-trying-to-load-emi-6-2-firmware.patch
1 From ac06c06770bb8761b1f1f9bdf2f5420fa6d3e9fa Mon Sep 17 00:00:00 2001
2 From: Clemens Ladisch <clemens@ladisch.de>
3 Date: Mon, 21 Dec 2009 15:36:44 -0800
4 Subject: USB: emi62: fix crash when trying to load EMI 6|2 firmware
5
6 From: Clemens Ladisch <clemens@ladisch.de>
7
8 commit ac06c06770bb8761b1f1f9bdf2f5420fa6d3e9fa upstream.
9
10 While converting emi62 to use request_firmware(), the driver was also
11 changed to use the ihex helper functions. However, this broke the loading
12 of the FPGA firmware because the code tries to access the addr field of
13 the EOF record which works with a plain array that has an empty last
14 record but not with the ihex helper functions where the end of the data is
15 signaled with a NULL record pointer, resulting in:
16
17 BUG: unable to handle kernel NULL pointer dereference at (null)
18 IP: [<f80d248c>] emi62_load_firmware+0x33c/0x740 [emi62]
19
20 This can be fixed by changing the loop condition to test the return value
21 of ihex_next_binrec() directly (like in emi26.c).
22
23 Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
24 Reported-and-tested-by: Der Mickster <retroeffective@gmail.com>
25 Acked-by: David Woodhouse <David.Woodhouse@intel.com>
26 Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
27 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
28
29 ---
30 drivers/usb/misc/emi62.c | 2 +-
31 1 file changed, 1 insertion(+), 1 deletion(-)
32
33 --- a/drivers/usb/misc/emi62.c
34 +++ b/drivers/usb/misc/emi62.c
35 @@ -167,7 +167,7 @@ static int emi62_load_firmware (struct u
36 err("%s - error loading firmware: error = %d", __func__, err);
37 goto wraperr;
38 }
39 - } while (i > 0);
40 + } while (rec);
41
42 /* Assert reset (stop the CPU in the EMI) */
43 err = emi62_set_reset(dev,1);