Commit 3d4bd24b authored by Florin Malita's avatar Florin Malita Committed by John W. Linville

[PATCH] libertas: skb dereferenced after netif_rx

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 and change the signature.
Signed-off-by: default avatarFlorin Malita <fmalita@gmail.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 55b637c6
...@@ -46,7 +46,7 @@ u32 libertas_index_to_data_rate(u8 index); ...@@ -46,7 +46,7 @@ u32 libertas_index_to_data_rate(u8 index);
u8 libertas_data_rate_to_index(u32 rate); u8 libertas_data_rate_to_index(u32 rate);
void libertas_get_fwversion(wlan_adapter * adapter, char *fwversion, int maxlen); void libertas_get_fwversion(wlan_adapter * adapter, char *fwversion, int maxlen);
int libertas_upload_rx_packet(wlan_private * priv, struct sk_buff *skb); void libertas_upload_rx_packet(wlan_private * priv, struct sk_buff *skb);
/** The proc fs interface */ /** The proc fs interface */
int libertas_process_rx_command(wlan_private * priv); int libertas_process_rx_command(wlan_private * priv);
......
...@@ -136,7 +136,7 @@ static void wlan_compute_rssi(wlan_private * priv, struct rxpd *p_rx_pd) ...@@ -136,7 +136,7 @@ static void wlan_compute_rssi(wlan_private * priv, struct rxpd *p_rx_pd)
LEAVE(); LEAVE();
} }
int libertas_upload_rx_packet(wlan_private * priv, struct sk_buff *skb) void libertas_upload_rx_packet(wlan_private * priv, struct sk_buff *skb)
{ {
lbs_pr_debug(1, "skb->data=%p\n", skb->data); lbs_pr_debug(1, "skb->data=%p\n", skb->data);
...@@ -148,8 +148,6 @@ int libertas_upload_rx_packet(wlan_private * priv, struct sk_buff *skb) ...@@ -148,8 +148,6 @@ int libertas_upload_rx_packet(wlan_private * priv, struct sk_buff *skb)
skb->ip_summed = CHECKSUM_UNNECESSARY; skb->ip_summed = CHECKSUM_UNNECESSARY;
netif_rx(skb); netif_rx(skb);
return 0;
} }
/** /**
...@@ -269,15 +267,11 @@ int libertas_process_rxed_packet(wlan_private * priv, struct sk_buff *skb) ...@@ -269,15 +267,11 @@ int libertas_process_rxed_packet(wlan_private * priv, struct sk_buff *skb)
wlan_compute_rssi(priv, p_rx_pd); wlan_compute_rssi(priv, p_rx_pd);
lbs_pr_debug(1, "RX Data: size of actual packet = %d\n", skb->len); 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_bytes += skb->len;
priv->stats.rx_packets++; priv->stats.rx_packets++;
libertas_upload_rx_packet(priv, skb);
ret = 0; ret = 0;
done: done:
LEAVE(); LEAVE();
...@@ -438,17 +432,11 @@ static int process_rxed_802_11_packet(wlan_private * priv, struct sk_buff *skb) ...@@ -438,17 +432,11 @@ static int process_rxed_802_11_packet(wlan_private * priv, struct sk_buff *skb)
wlan_compute_rssi(priv, prxpd); wlan_compute_rssi(priv, prxpd);
lbs_pr_debug(1, "RX Data: size of actual packet = %d\n", skb->len); 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_bytes += skb->len;
priv->stats.rx_packets++; priv->stats.rx_packets++;
libertas_upload_rx_packet(priv, skb);
ret = 0; ret = 0;
done: done:
LEAVE(); LEAVE();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment