Subject: Re: bnx2_poll panicking kernel

From: Jarek Poplawski <[email-masked]>
Date: Sat, 12 Jul 2008 11:49:14 +0200

David Miller wrote, On 07/11/2008 11:56 AM:
...

> diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c
> index 3fb58f4..aa20b47 100644
> --- a/net/sched/sch_htb.c
> +++ b/net/sched/sch_htb.c
> @@ -583,6 +583,7 @@ static int htb_enqueue(struct sk_buff *skb, struct Qdisc *sch)
>  		if (q->direct_queue.qlen < q->direct_qlen) {
>  			__skb_queue_tail(&q->direct_queue, skb);
>  			q->direct_pkts++;
> +			ret = NET_XMIT_SUCCESS;
>  		} else {
>  			kfree_skb(skb);
>  			sch->qstats.drops++;
> @@ -595,22 +596,26 @@ static int htb_enqueue(struct sk_buff *skb, struct Qdisc *sch)
>  		kfree_skb(skb);
>  		return ret;
>  #endif
> -	} else if (cl->un.leaf.q->enqueue(skb, cl->un.leaf.q) !=
> -		   NET_XMIT_SUCCESS) {
> -		sch->qstats.drops++;
> -		cl->qstats.drops++;
> -		return NET_XMIT_DROP;
>  	} else {
> -		cl->bstats.packets +=
> -			skb_is_gso(skb)?skb_shinfo(skb)->gso_segs:1;
> -		cl->bstats.bytes += skb->len;
> -		htb_activate(q, cl);
> +		ret = cl->un.leaf.q->enqueue(skb, cl->un.leaf.q);
> +		if (ret == NET_XMIT_DROP) {
> +			sch->qstats.drops++;
> +			cl->qstats.drops++;
> +		} else {
> +			cl->bstats.packets +=
> +				skb_is_gso(skb)?skb_shinfo(skb)->gso_segs:1;
> +			cl->bstats.bytes += skb->len;
> +			htb_activate(q, cl);

This isn't correct: htb_activate() needs cl->un.leaf.q->q.qlen > 0, and
only NET_XMIT_SUCCESS can guarantee this.

Jarek P.