aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/p54
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2011-02-27 16:19:22 -0500
committerJohn W. Linville <linville@tuxdriver.com>2011-02-28 14:06:54 -0500
commita5a7103fe18eb4312bd89c9f136fb850af58faf4 (patch)
tree2242178941a40c30adcc13705bf990249bb9093b /drivers/net/wireless/p54
parentc2a7dca0ce0e6ceb13f9030ff8e9731eaa14cc02 (diff)
p54: fix a NULL pointer dereference bug
If the RSSI calibration table was not found or not parsed properly, priv->rssi_db will be NULL, p54_rssi_find needs to be able to deal with that. Signed-off-by: Felix Fietkau <nbd@openwrt.org> Acked-by: Christian Lamparter <chunkeey@googlemail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/p54')
-rw-r--r--drivers/net/wireless/p54/eeprom.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/net/wireless/p54/eeprom.c b/drivers/net/wireless/p54/eeprom.c
index f54e15fcd623..13d750da9301 100644
--- a/drivers/net/wireless/p54/eeprom.c
+++ b/drivers/net/wireless/p54/eeprom.c
@@ -524,10 +524,13 @@ err_data:
524 524
525struct p54_rssi_db_entry *p54_rssi_find(struct p54_common *priv, const u16 freq) 525struct p54_rssi_db_entry *p54_rssi_find(struct p54_common *priv, const u16 freq)
526{ 526{
527 struct p54_rssi_db_entry *entry = (void *)(priv->rssi_db->data + 527 struct p54_rssi_db_entry *entry;
528 priv->rssi_db->offset);
529 int i, found = -1; 528 int i, found = -1;
530 529
530 if (!priv->rssi_db)
531 return &p54_rssi_default;
532
533 entry = (void *)(priv->rssi_db->data + priv->rssi_db->offset);
531 for (i = 0; i < priv->rssi_db->entries; i++) { 534 for (i = 0; i < priv->rssi_db->entries; i++) {
532 if (!same_band(freq, entry[i].freq)) 535 if (!same_band(freq, entry[i].freq))
533 continue; 536 continue;