lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 04 Dec 2007 10:01:37 +0800
From:	Wang Chen <wangchen@...fujitsu.com>
To:	Peter Korsgaard <jacmet@...site.dk>
CC:	Jeff Garzik <jgarzik@...ox.com>,
	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

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);
 
 	spin_lock_irqsave(&lp->lock, flags);
 	pkts = (SMC_GET_RX_FIFO_INF() & RX_FIFO_INF_RXSUSED_) >> 16;

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

Powered by Openwall GNU/*/Linux Powered by OpenVZ