Skip to contentSkip to conversation

staging: ks7010: avoid dereferencing packet if it is null

PATCH New Colin King 1 participant 1 message Sep 7, 2016 Staging

lore
Share & tools
lore

Colin King

author
#0 lore raw

PATCH 1/1 staging: ks7010: avoid dereferencing packet if it is null

From: Colin Ian King <[email protected]>

Updating tx_bytes from packet->len if packet is null will cause a null pointer dereference, so only update tx_bytes if it packet is not null.

---
 drivers/staging/ks7010/ks_wlan_net.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/ks7010/ks_wlan_net.c +1 -1
index 1e21eb1..d69b4c9 100644
@@ -3396,13 +3396,13 @@ void send_packet_complete(void *arg1, void *arg2)
 
 	DPRINTK(3, "\n");
 
-	priv->nstats.tx_bytes += packet->len;
 	priv->nstats.tx_packets++;
 
 	if (netif_queue_stopped(priv->net_dev))
 		netif_wake_queue(priv->net_dev);
 
 	if (packet) {
+		priv->nstats.tx_bytes += packet->len;
 		dev_kfree_skb(packet);
 		packet = NULL;
 	}
Signature · 1 line
2.9.3