Skip to contentSkip to conversation

rt2x00: rt2x00_rev() should return u32

PATCH New Ivo van Doorn 1 participant 3 messages Jan 23, 2009 Networking drivers (wireless)

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 rt2x00: rt2x00_rev() should return u32

The "rev" field in chipset definition is an u32, which means that rt2x00_rev() which returns that field should be of the same type.

---
 drivers/net/wireless/rt2x00/rt2x00.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/wireless/rt2x00/rt2x00.h +1 -1
index cc56637..d39e834 100644
@@ -868,7 +868,7 @@ static inline char rt2x00_rf(const struct rt2x00_chip *chipset, const u16 chip)
 	return (chipset->rf == chip);
 }
 
-static inline u16 rt2x00_rev(const struct rt2x00_chip *chipset)
+static inline u32 rt2x00_rev(const struct rt2x00_chip *chipset)
 {
 	return chipset->rev;
 }
Signature · 1 line
1.5.6.1
#1 lore raw

PATCH 2/3 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.

---
 drivers/net/wireless/rt2x00/rt61pci.c |    5 +++++
 drivers/net/wireless/rt2x00/rt73usb.c |    5 +++++
 2 files changed, 10 insertions(+), 0 deletions(-)
drivers/net/wireless/rt2x00/rt61pci.c +5 -0
index 3a7ecca..d81a8de 100644
@@ -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.
 	 */
drivers/net/wireless/rt2x00/rt73usb.c +5 -0
index 60c43c1..f854551 100644
@@ -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.
 	 */
Signature · 1 line
1.5.6.1
#2 lore raw

PATCH 3/3 rt2x00: Simplify suspend/resume handling

With mac80211 handling all open interfaces during
suspend and resume we can simplify suspend/resume
within rt2x00lib.

The only thing rt2x00 needs to do is free up memory during suspend and bring back the minimal required components during resume.

---
 drivers/net/wireless/rt2x00/rt2x00.h    |    1 -
 drivers/net/wireless/rt2x00/rt2x00dev.c |   93 ++-----------------------------
 2 files changed, 5 insertions(+), 89 deletions(-)
drivers/net/wireless/rt2x00/rt2x00.h +0 -1
index d39e834..bd03751 100644
@@ -575,7 +575,6 @@ enum rt2x00_flags {
 	DEVICE_STATE_REGISTERED_HW,
 	DEVICE_STATE_INITIALIZED,
 	DEVICE_STATE_STARTED,
-	DEVICE_STATE_STARTED_SUSPEND,
 	DEVICE_STATE_ENABLED_RADIO,
 	DEVICE_STATE_DISABLED_RADIO_HW,
 
drivers/net/wireless/rt2x00/rt2x00dev.c +5 -88

137 lines not on this page · raw message

Signature · 1 line
1.5.6.1