2011-02-27 21:19:26

by Felix Fietkau

[permalink] [raw]
Subject: [PATCH] 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 <[email protected]>
---
drivers/net/wireless/p54/eeprom.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/p54/eeprom.c b/drivers/net/wireless/p54/eeprom.c
index f54e15f..13d750d 100644
--- a/drivers/net/wireless/p54/eeprom.c
+++ b/drivers/net/wireless/p54/eeprom.c
@@ -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;
--
1.7.3.2



2011-02-28 12:08:37

by Christian Lamparter

[permalink] [raw]
Subject: Re: [PATCH] p54: fix a NULL pointer dereference bug

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_db will be NULL, p54_rssi_find needs to be able to deal
> with that.

Acked-by: Christian Lamparter <[email protected]>

Did someone report an oops and if so, what card was it?
And is it possible to get the EEPROM image?

Regards,
Chr

2011-02-28 13:29:39

by Felix Fietkau

[permalink] [raw]
Subject: Re: [PATCH] p54: fix a NULL pointer dereference bug

On 2011-02-28 1:08 PM, Christian Lamparter wrote:
> 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_db will be NULL, p54_rssi_find needs to be able to deal
>> with that.
>
> Acked-by: Christian Lamparter <[email protected]>
>
> 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

2011-03-01 17:30:49

by Christian Lamparter

[permalink] [raw]
Subject: Re: [PATCH] p54: fix a NULL pointer dereference bug

On Monday 28 February 2011 14:29:34 Felix Fietkau wrote:
> On 2011-02-28 1:08 PM, Christian Lamparter wrote:
> > 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_db will be NULL, p54_rssi_find needs to be able to deal
> >> with that.
> >
> > Acked-by: Christian Lamparter <[email protected]>
> >
> > 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.

> 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