Skip to contentSkip to conversation

WiMAX pull request

PATCH In review Inaky Perez-Gonzalez 2 participants 3 messages May 25, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 WiMAX pull request

From: Inaky Perez-Gonzalez <[email protected]>

The following changes since commit 0fb0a4f00aaf5de9f328273d7a46e3aa27dab496:
Inaky Perez-Gonzalez (1):
wimax/i2400m: driver defaults to firmware v1.5 for i6x60 devices

are available in the git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/inaky/wimax.git wimax-2.6.35.y

Patches follow for reviewing convenience.

Inaky Perez-Gonzalez (1):
wimax/i2400m: fix bad race condition check in RX path

 drivers/net/wimax/i2400m/rx.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
#1 lore raw

PATCH 1/1 wimax/i2400m: fix bad race condition check in RX path

From: Inaky Perez-Gonzalez <[email protected]>

The i2400m->rx_roq data structure is protected against race conditions with a reference count (i2400m->rx_roq_refcount); the pointer can be read-referenced under the i2400m->rx_lock spinlock.

The code in i2400m_rx_edata() wasn't properly following access protocol, performing an invalid check on i2400m->rx_roq (which is cleared to NULL when the refcount drops to zero). As such, it was missing to detect when the data structure is no longer valid and oopsing with a NULL pointer dereference.

This commit fixes said check by verifying, under the rx_lock spinlock, that i2400m->rx_roq is non-NULL and then increasing the reference count before dropping the spinlock.

---
 drivers/net/wimax/i2400m/rx.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/wimax/i2400m/rx.c +2 -2
index c835ae8..6cd12d6 100644
@@ -1033,12 +1033,12 @@ void i2400m_rx_edata(struct i2400m *i2400m, struct sk_buff *skb_rx,
 		ro_sn = (reorder >> I2400M_RO_SN_SHIFT) & I2400M_RO_SN;
 
 		spin_lock_irqsave(&i2400m->rx_lock, flags);
-		roq = &i2400m->rx_roq[ro_cin];
-		if (roq == NULL) {
+		if (i2400m->rx_roq == NULL) {
 			kfree_skb(skb);	/* rx_roq is already destroyed */
 			spin_unlock_irqrestore(&i2400m->rx_lock, flags);
 			goto error;
 		}
+		roq = &i2400m->rx_roq[ro_cin];
 		kref_get(&i2400m->rx_roq_refcount);
 		spin_unlock_irqrestore(&i2400m->rx_lock, flags);
 
Signature · 1 line
1.6.6.1
maintainer
#2 lore raw
In reply to Inaky Perez-Gonzalez

From: Inaky Perez-Gonzalez <[email protected]>
Date: Tue, 25 May 2010 10:45:12 -0700

Quoted 9 lines

The following changes since commit 0fb0a4f00aaf5de9f328273d7a46e3aa27dab496:
Inaky Perez-Gonzalez (1):
wimax/i2400m: driver defaults to firmware v1.5 for i6x60 devices

are available in the git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/inaky/wimax.git wimax-2.6.35.y

Patches follow for reviewing convenience.

Pulled, thank you.