Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ac06c067 authored by Clemens Ladisch's avatar Clemens Ladisch Committed by Greg Kroah-Hartman
Browse files

USB: emi62: fix crash when trying to load EMI 6|2 firmware



While converting emi62 to use request_firmware(), the driver was also
changed to use the ihex helper functions.  However, this broke the loading
of the FPGA firmware because the code tries to access the addr field of
the EOF record which works with a plain array that has an empty last
record but not with the ihex helper functions where the end of the data is
signaled with a NULL record pointer, resulting in:

BUG: unable to handle kernel NULL pointer dereference at (null)
IP: [<f80d248c>] emi62_load_firmware+0x33c/0x740 [emi62]

This can be fixed by changing the loop condition to test the return value
of ihex_next_binrec() directly (like in emi26.c).

Signed-off-by: default avatarClemens Ladisch <clemens@ladisch.de>
Reported-and-tested-by: default avatarDer Mickster <retroeffective@gmail.com>
Acked-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
Cc: stable <stable@kernel.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 27f1281d
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -167,7 +167,7 @@ static int emi62_load_firmware (struct usb_device *dev)
			err("%s - error loading firmware: error = %d", __func__, err);
			err("%s - error loading firmware: error = %d", __func__, err);
			goto wraperr;
			goto wraperr;
		}
		}
	} while (i > 0);
	} while (rec);


	/* Assert reset (stop the CPU in the EMI) */
	/* Assert reset (stop the CPU in the EMI) */
	err = emi62_set_reset(dev,1);
	err = emi62_set_reset(dev,1);