diff options
author | Christian Lamparter <chunkeey@web.de> | 2008-12-26 13:09:34 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-01-29 15:59:39 -0500 |
commit | e365f16046b72977ec22364215b57af840f0907e (patch) | |
tree | bbd5f2b2525e3077f9d466715e0e49ade539e6ff /drivers/net | |
parent | 6982869d993009c02cefcca98a67b212d0e61c5f (diff) |
p54: prevent upload of wrong firmwares
This patch will prevent anyone to upload a firmware which was not designed for his device.
There's still a catch:
There is no easy way to detect if a firmware is for PCI or for USB (1st Gen),
because they all share the same LM86 identifier.
Signed-off-by: Christian Lamparter <chunkeey@web.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/wireless/p54/p54pci.c | 6 | ||||
-rw-r--r-- | drivers/net/wireless/p54/p54usb.c | 15 |
2 files changed, 21 insertions, 0 deletions
diff --git a/drivers/net/wireless/p54/p54pci.c b/drivers/net/wireless/p54/p54pci.c index aa367a0ddc49..3f9a6b04ea95 100644 --- a/drivers/net/wireless/p54/p54pci.c +++ b/drivers/net/wireless/p54/p54pci.c | |||
@@ -79,6 +79,12 @@ static int p54p_upload_firmware(struct ieee80211_hw *dev) | |||
79 | if (err) | 79 | if (err) |
80 | return err; | 80 | return err; |
81 | 81 | ||
82 | if (priv->common.fw_interface != FW_LM86) { | ||
83 | dev_err(&priv->pdev->dev, "wrong firmware, " | ||
84 | "please get a LM86(PCI) firmware a try again.\n"); | ||
85 | return -EINVAL; | ||
86 | } | ||
87 | |||
82 | data = (__le32 *) priv->firmware->data; | 88 | data = (__le32 *) priv->firmware->data; |
83 | remains = priv->firmware->size; | 89 | remains = priv->firmware->size; |
84 | device_addr = ISL38XX_DEV_FIRMWARE_ADDR; | 90 | device_addr = ISL38XX_DEV_FIRMWARE_ADDR; |
diff --git a/drivers/net/wireless/p54/p54usb.c b/drivers/net/wireless/p54/p54usb.c index 3c31c15267b5..44d6855bd17c 100644 --- a/drivers/net/wireless/p54/p54usb.c +++ b/drivers/net/wireless/p54/p54usb.c | |||
@@ -498,6 +498,13 @@ static int p54u_upload_firmware_3887(struct ieee80211_hw *dev) | |||
498 | if (err) | 498 | if (err) |
499 | goto err_upload_failed; | 499 | goto err_upload_failed; |
500 | 500 | ||
501 | if (priv->common.fw_interface != FW_LM87) { | ||
502 | dev_err(&priv->udev->dev, "wrong firmware, " | ||
503 | "please get a LM87 firmware and try again.\n"); | ||
504 | err = -EINVAL; | ||
505 | goto err_upload_failed; | ||
506 | } | ||
507 | |||
501 | left = block_size = min((size_t)P54U_FW_BLOCK, fw_entry->size); | 508 | left = block_size = min((size_t)P54U_FW_BLOCK, fw_entry->size); |
502 | strcpy(buf, p54u_firmware_upload_3887); | 509 | strcpy(buf, p54u_firmware_upload_3887); |
503 | left -= strlen(p54u_firmware_upload_3887); | 510 | left -= strlen(p54u_firmware_upload_3887); |
@@ -648,6 +655,14 @@ static int p54u_upload_firmware_net2280(struct ieee80211_hw *dev) | |||
648 | return err; | 655 | return err; |
649 | } | 656 | } |
650 | 657 | ||
658 | if (priv->common.fw_interface != FW_LM86) { | ||
659 | dev_err(&priv->udev->dev, "wrong firmware, " | ||
660 | "please get a LM86(USB) firmware and try again.\n"); | ||
661 | kfree(buf); | ||
662 | release_firmware(fw_entry); | ||
663 | return -EINVAL; | ||
664 | } | ||
665 | |||
651 | #define P54U_WRITE(type, addr, data) \ | 666 | #define P54U_WRITE(type, addr, data) \ |
652 | do {\ | 667 | do {\ |
653 | err = p54u_write(priv, buf, type,\ | 668 | err = p54u_write(priv, buf, type,\ |