diff mbox

cxgb3: Fix kernel crash caused by uninitialized l2t_entry.arpq

Message ID ada63nqsyxp.fsf@cisco.com
State Accepted, archived
Delegated to: Jeff Garzik
Headers show

Commit Message

Roland Dreier Oct. 17, 2008, 9:18 p.m. UTC
Commit 147e70e6 ("cxgb3: Use SKB list interfaces instead of home-grown
implementation.") causes a crash in t3_l2t_send_slow() when an iWARP
connection request is received.  This is because the new l2t_entry.arpq
skb queue is never initialized, and therefore trying to add an skb to
it causes a NULL dereference.  With the old code there was no need to
initialize the queues because the l2t_entry structures were zeroed,
and the code used NULL to mean empty.

Fix this by adding __skb_queue_head_init() when all the l2t_entry
structures get allocated.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
---
This should probably go to -stable as well, since it looks like the
commit that broke things went into 2.6.27-rc6.

 drivers/net/cxgb3/l2t.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

David Miller Oct. 17, 2008, 11:31 p.m. UTC | #1
From: Roland Dreier <rdreier@cisco.com>
Date: Fri, 17 Oct 2008 14:18:26 -0700

> Commit 147e70e6 ("cxgb3: Use SKB list interfaces instead of home-grown
> implementation.") causes a crash in t3_l2t_send_slow() when an iWARP
> connection request is received.  This is because the new l2t_entry.arpq
> skb queue is never initialized, and therefore trying to add an skb to
> it causes a NULL dereference.  With the old code there was no need to
> initialize the queues because the l2t_entry structures were zeroed,
> and the code used NULL to mean empty.
> 
> Fix this by adding __skb_queue_head_init() when all the l2t_entry
> structures get allocated.
> 
> Signed-off-by: Roland Dreier <rolandd@cisco.com>

Acked-by: David S. Miller <davem@davemloft.net>

> This should probably go to -stable as well, since it looks like the
> commit that broke things went into 2.6.27-rc6.

Indeed.

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Divy Le Ray Oct. 20, 2008, 5:10 p.m. UTC | #2
David Miller wrote:
> From: Roland Dreier <rdreier@cisco.com>
> Date: Fri, 17 Oct 2008 14:18:26 -0700
>
>   
>> Commit 147e70e6 ("cxgb3: Use SKB list interfaces instead of home-grown
>> implementation.") causes a crash in t3_l2t_send_slow() when an iWARP
>> connection request is received.  This is because the new l2t_entry.arpq
>> skb queue is never initialized, and therefore trying to add an skb to
>> it causes a NULL dereference.  With the old code there was no need to
>> initialize the queues because the l2t_entry structures were zeroed,
>> and the code used NULL to mean empty.
>>
>> Fix this by adding __skb_queue_head_init() when all the l2t_entry
>> structures get allocated.
>>
>> Signed-off-by: Roland Dreier <rolandd@cisco.com>
>>     
>
> Acked-by: David S. Miller <davem@davemloft.net>
>   
Acked-by: Divy Le ray <divy@chelsio.com>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jeff Garzik Oct. 21, 2008, 6:10 a.m. UTC | #3
Roland Dreier wrote:
> Commit 147e70e6 ("cxgb3: Use SKB list interfaces instead of home-grown
> implementation.") causes a crash in t3_l2t_send_slow() when an iWARP
> connection request is received.  This is because the new l2t_entry.arpq
> skb queue is never initialized, and therefore trying to add an skb to
> it causes a NULL dereference.  With the old code there was no need to
> initialize the queues because the l2t_entry structures were zeroed,
> and the code used NULL to mean empty.
> 
> Fix this by adding __skb_queue_head_init() when all the l2t_entry
> structures get allocated.
> 
> Signed-off-by: Roland Dreier <rolandd@cisco.com>
> ---
> This should probably go to -stable as well, since it looks like the
> commit that broke things went into 2.6.27-rc6.
> 
>  drivers/net/cxgb3/l2t.c |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/net/cxgb3/l2t.c b/drivers/net/cxgb3/l2t.c
> index 4407ac9..ff1611f 100644
> --- a/drivers/net/cxgb3/l2t.c
> +++ b/drivers/net/cxgb3/l2t.c
> @@ -431,6 +431,7 @@ struct l2t_data *t3_init_l2t(unsigned int l2t_capacity)
>  	for (i = 0; i < l2t_capacity; ++i) {
>  		d->l2tab[i].idx = i;
>  		d->l2tab[i].state = L2T_STATE_UNUSED;
> +		__skb_queue_head_init(&d->l2tab[i].arpq);
>  		spin_lock_init(&d->l2tab[i].lock);
>  		atomic_set(&d->l2tab[i].refcnt, 0);

applied


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/cxgb3/l2t.c b/drivers/net/cxgb3/l2t.c
index 4407ac9..ff1611f 100644
--- a/drivers/net/cxgb3/l2t.c
+++ b/drivers/net/cxgb3/l2t.c
@@ -431,6 +431,7 @@  struct l2t_data *t3_init_l2t(unsigned int l2t_capacity)
 	for (i = 0; i < l2t_capacity; ++i) {
 		d->l2tab[i].idx = i;
 		d->l2tab[i].state = L2T_STATE_UNUSED;
+		__skb_queue_head_init(&d->l2tab[i].arpq);
 		spin_lock_init(&d->l2tab[i].lock);
 		atomic_set(&d->l2tab[i].refcnt, 0);
 	}