netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] libertas: skb dereferenced after netif_rx
@ 2007-05-16 21:01 Florin Malita
       [not found] ` <464B7127.5080502-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 11+ messages in thread
From: Florin Malita @ 2007-05-16 21:01 UTC (permalink / raw)
  To: marcelo, linville; +Cc: netdev

In libertas_process_rxed_packet() and process_rxed_802_11_packet() the 
skb is dereferenced after being passed to netif_rx (called from 
libertas_upload_rx_packet). Spotted by Coverity (1658, 1659).

Also, libertas_upload_rx_packet() unconditionally returns 0 so the error 
check is dead code - might as well take it out.


Signed-off-by: Florin Malita <fmalita@gmail.com>
---

 rx.c |   18 ++++--------------
 1 file changed, 4 insertions(+), 14 deletions(-)

diff --git a/drivers/net/wireless/libertas/rx.c b/drivers/net/wireless/libertas/rx.c
index d17924f..5e98055 100644
--- a/drivers/net/wireless/libertas/rx.c
+++ b/drivers/net/wireless/libertas/rx.c
@@ -269,15 +269,11 @@ int libertas_process_rxed_packet(wlan_private * priv, struct sk_buff *skb)
 	wlan_compute_rssi(priv, p_rx_pd);
 
 	lbs_pr_debug(1, "RX Data: size of actual packet = %d\n", skb->len);
-	if (libertas_upload_rx_packet(priv, skb)) {
-		lbs_pr_debug(1, "RX error: libertas_upload_rx_packet"
-		       " returns failure\n");
-		ret = -1;
-		goto done;
-	}
 	priv->stats.rx_bytes += skb->len;
 	priv->stats.rx_packets++;
 
+	libertas_upload_rx_packet(priv, skb);
+
 	ret = 0;
 done:
 	LEAVE();
@@ -438,17 +434,11 @@ static int process_rxed_802_11_packet(wlan_private * priv, struct sk_buff *skb)
 	wlan_compute_rssi(priv, prxpd);
 
 	lbs_pr_debug(1, "RX Data: size of actual packet = %d\n", skb->len);
-
-	if (libertas_upload_rx_packet(priv, skb)) {
-		lbs_pr_debug(1, "RX error: libertas_upload_rx_packet "
-			"returns failure\n");
-		ret = -1;
-		goto done;
-	}
-
 	priv->stats.rx_bytes += skb->len;
 	priv->stats.rx_packets++;
 
+	libertas_upload_rx_packet(priv, skb);
+
 	ret = 0;
 done:
 	LEAVE();


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2007-05-21 14:51 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-16 21:01 [PATCH] libertas: skb dereferenced after netif_rx Florin Malita
     [not found] ` <464B7127.5080502-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2007-05-18 18:09   ` John W. Linville
     [not found]     ` <20070518180903.GC3492-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org>
2007-05-18 20:04       ` Florin Malita
2007-05-19  5:23       ` Stephen Hemminger
2007-05-19  5:37         ` Jeff Garzik
2007-05-20  0:56     ` Dan Williams
2007-05-20  1:47       ` Jeff Garzik
     [not found]         ` <464FA894.8090008-o2qLIJkoznsdnm+yROfE0A@public.gmane.org>
2007-05-20  5:20           ` Stephen Hemminger
2007-05-20  6:36             ` Jeff Garzik
2007-05-20  7:38           ` David Miller
     [not found]             ` <20070520.003832.59470116.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2007-05-21 14:51               ` Florin Malita

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).