p54: fix a NULL pointer dereference bug
PATCH 1/1 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.
--- drivers/net/wireless/p54/eeprom.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-)
drivers/net/wireless/p54/eeprom.c +5 -2
@@ -524,10 +524,13 @@ err_data:struct p54_rssi_db_entry *p54_rssi_find (struct p54_common *priv,const u16 freq) { -struct p54_rssi_db_entry *entry = (void *)(priv->rssi_db->data + - priv->rssi_db->offset); +struct p54_rssi_db_entry *entry;int i, found =-1 ; +if (!priv->rssi_db) +return &p54_rssi_default; + + entry = (void *)(priv->rssi_db->data + priv->rssi_db->offset);for (i =0 ; i < priv->rssi_db->entries; i++) {if (!same_band (freq, entry[i].freq))continue ;
Signature · 1 line
1.7.3.2
Quoted 3 lines · On Sunday 27 February 2011 22:19:22 Felix Fietkau wrote:
If the RSSI calibration table was not found or not parsed properly,
priv->rssi_dbwill be NULL,p54_rssi_findneeds to be able to deal with that.
Did someone report an oops and if so, what card was it? And is it possible to get the EEPROM image?
Regards,
Chr
Quoted 9 lines · Christian Lamparter
Quoted 3 lines · On Sunday 27 February 2011 22:19:22 Felix Fietkau wrote:
If the RSSI calibration table was not found or not parsed properly,
priv->rssi_dbwill be NULL,p54_rssi_findneeds to be able to deal with that.Did someone report an oops and if so, what card was it? And is it possible to get the EEPROM image?
Michael Buesch reported it using OpenWrt on the Nokia N810. The image was generated with these tools:
http://nbd.name/gitweb.cgi?p=packages.git;a=tree;f=utils/calvaria/files/src;hb=HEAD
- Felix
Quoted 11 lines · On Monday 28 February 2011 14:29:34 Felix Fietkau wrote:
Quoted 9 lines · Christian Lamparter
Quoted 3 lines · On Sunday 27 February 2011 22:19:22 Felix Fietkau wrote:
If the RSSI calibration table was not found or not parsed properly,
priv->rssi_dbwill be NULL,p54_rssi_findneeds to be able to deal with that.Did someone report an oops and if so, what card was it? And is it possible to get the EEPROM image?
Michael Buesch reported it using OpenWrt on the Nokia N810.
Thanks. For a moment I feared that more broken devices are out there.
Quoted 2 lines
The image was generated with these tools:
http://nbd.name/gitweb.cgi?p=packages.git;a=tree;f=utils/calvaria/files/src;hb=HEAD
you know, I have made some "tools" for editing & viewing eeprom images as well:
http://git.kernel.org/?p=linux/kernel/git/chr/p54tools.git
Regards,
Chr