[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <4755B07A.7060508@pobox.com>
Date: Tue, 04 Dec 2007 14:54:34 -0500
From: Jeff Garzik <jgarzik@...ox.com>
To: Wang Chen <wangchen@...fujitsu.com>
CC: Peter Korsgaard <jacmet@...site.dk>,
Herbert Xu <herbert@...dor.apana.org.au>,
Dustin McIntire <dustin@...soria.com>, davem@...emloft.net,
netdev@...r.kernel.org
Subject: Re: [PATCH] SMC911X: Fix using of dereferenced skb after netif_rx
Wang Chen wrote:
> Peter Korsgaard said the following on 2007-12-3 21:47:
>>>>>>> "Wang" == Wang Chen <wangchen@...fujitsu.com> writes:
>> Hi,
>>
>> Wang> + len = skb->len;
>> Wang> netif_rx(skb);
>> dev-> stats.rx_packets++;
>> Wang> - dev->stats.rx_bytes += skb->len;
>> Wang> + dev->stats.rx_bytes += len;
>>
>> Why not simply update the stats before calling netif_rx as the return
>> value isn't checked anyway?
>>
>
> Even the return value of netif_rx isn't checked, dev->stats maybe
> changed in netif_rx. But fortunately dev->stats isn't changed in
> netif_rx.
> So, I agree.
> Here is the new patch.
>
> Signed-off-by: Wang Chen <wangchen@...fujitsu.com>
> ---
> smc911x.c | 2 +-
> 1 files changed, 1 insertion(+), 1 deletion(-)
>
> --- linux-2.6.24.rc3.org/drivers/net/smc911x.c 2007-11-19 12:38:05.000000000 +0800
> +++ linux-2.6.24.rc3/drivers/net/smc911x.c 2007-12-04 09:59:06.000000000 +0800
> @@ -1299,9 +1299,9 @@ smc911x_rx_dma_irq(int dma, void *data)
> PRINT_PKT(skb->data, skb->len);
> dev->last_rx = jiffies;
> skb->protocol = eth_type_trans(skb, dev);
> - netif_rx(skb);
> dev->stats.rx_packets++;
> dev->stats.rx_bytes += skb->len;
> + netif_rx(skb);
>
applied #upstream-fixes
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists