linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] p54: fix a NULL pointer dereference bug
@ 2011-02-27 21:19 Felix Fietkau
  2011-02-28 12:08 ` Christian Lamparter
  0 siblings, 1 reply; 4+ messages in thread
From: Felix Fietkau @ 2011-02-27 21:19 UTC (permalink / raw)
  To: linux-wireless; +Cc: linville, chunkeey

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>
---
 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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] p54: fix a NULL pointer dereference bug
  2011-02-27 21:19 [PATCH] p54: fix a NULL pointer dereference bug Felix Fietkau
@ 2011-02-28 12:08 ` Christian Lamparter
  2011-02-28 13:29   ` Felix Fietkau
  0 siblings, 1 reply; 4+ messages in thread
From: Christian Lamparter @ 2011-02-28 12:08 UTC (permalink / raw)
  To: Felix Fietkau; +Cc: linux-wireless, linville

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 <chunkeey@googlemail.com>

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

Regards,
	Chr

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] p54: fix a NULL pointer dereference bug
  2011-02-28 12:08 ` Christian Lamparter
@ 2011-02-28 13:29   ` Felix Fietkau
  2011-03-01 17:30     ` Christian Lamparter
  0 siblings, 1 reply; 4+ messages in thread
From: Felix Fietkau @ 2011-02-28 13:29 UTC (permalink / raw)
  To: Christian Lamparter; +Cc: linux-wireless, linville, Michael Buesch

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 <chunkeey@googlemail.com>
> 
> 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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] p54: fix a NULL pointer dereference bug
  2011-02-28 13:29   ` Felix Fietkau
@ 2011-03-01 17:30     ` Christian Lamparter
  0 siblings, 0 replies; 4+ messages in thread
From: Christian Lamparter @ 2011-03-01 17:30 UTC (permalink / raw)
  To: Felix Fietkau; +Cc: linux-wireless, linville, Michael Buesch

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 <chunkeey@googlemail.com>
> > 
> > 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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-03-01 17:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-27 21:19 [PATCH] p54: fix a NULL pointer dereference bug Felix Fietkau
2011-02-28 12:08 ` Christian Lamparter
2011-02-28 13:29   ` Felix Fietkau
2011-03-01 17:30     ` Christian Lamparter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).