Commit 9752a7bd authored by Ivo van Doorn's avatar Ivo van Doorn Committed by John W. Linville

rt2x00: Restrict firmware file lengths

Add extra security to the drivers for firmware loading,
check the firmware file length before uploading it to
the hardware. Incorrect lengths might indicate a firmware
upgrade (which is not yet supported by the driver) or
otherwise incorrect firmware.
Signed-off-by: default avatarIvo van Doorn <IvDoorn@gmail.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 6ba265e9
...@@ -1199,6 +1199,11 @@ static int rt61pci_load_firmware(struct rt2x00_dev *rt2x00dev, const void *data, ...@@ -1199,6 +1199,11 @@ static int rt61pci_load_firmware(struct rt2x00_dev *rt2x00dev, const void *data,
int i; int i;
u32 reg; u32 reg;
if (len != 8192) {
ERROR(rt2x00dev, "Invalid firmware file length (len=%zu)\n", len);
return -ENOENT;
}
/* /*
* Wait for stable hardware. * Wait for stable hardware.
*/ */
......
...@@ -1085,6 +1085,11 @@ static int rt73usb_load_firmware(struct rt2x00_dev *rt2x00dev, const void *data, ...@@ -1085,6 +1085,11 @@ static int rt73usb_load_firmware(struct rt2x00_dev *rt2x00dev, const void *data,
int status; int status;
u32 reg; u32 reg;
if (len != 2048) {
ERROR(rt2x00dev, "Invalid firmware file length (len=%zu)\n", len);
return -ENOENT;
}
/* /*
* Wait for stable hardware. * Wait for stable hardware.
*/ */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment