Skip to content

Commit

Permalink
rt2x00: Restrict firmware file lengths
Browse files Browse the repository at this point in the history
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: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
Ivo van Doorn authored and John W. Linville committed Jan 29, 2009
1 parent 6ba265e commit 9752a7b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions drivers/net/wireless/rt2x00/rt61pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -1199,6 +1199,11 @@ static int rt61pci_load_firmware(struct rt2x00_dev *rt2x00dev, const void *data,
int i;
u32 reg;

if (len != 8192) {
ERROR(rt2x00dev, "Invalid firmware file length (len=%zu)\n", len);
return -ENOENT;
}

/*
* Wait for stable hardware.
*/
Expand Down
5 changes: 5 additions & 0 deletions drivers/net/wireless/rt2x00/rt73usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1085,6 +1085,11 @@ static int rt73usb_load_firmware(struct rt2x00_dev *rt2x00dev, const void *data,
int status;
u32 reg;

if (len != 2048) {
ERROR(rt2x00dev, "Invalid firmware file length (len=%zu)\n", len);
return -ENOENT;
}

/*
* Wait for stable hardware.
*/
Expand Down

0 comments on commit 9752a7b

Please sign in to comment.