All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: ks7010: avoid dereferencing packet if it is null
@ 2016-09-07 16:23 Colin King
  0 siblings, 0 replies; only message in thread
From: Colin King @ 2016-09-07 16:23 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Wolfram Sang, Dan Carpenter, devel; +Cc: linux-kernel

From: Colin Ian King <colin.king@canonical.com>

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.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/staging/ks7010/ks_wlan_net.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/ks7010/ks_wlan_net.c b/drivers/staging/ks7010/ks_wlan_net.c
index 1e21eb1..d69b4c9 100644
--- a/drivers/staging/ks7010/ks_wlan_net.c
+++ b/drivers/staging/ks7010/ks_wlan_net.c
@@ -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;
 	}
-- 
2.9.3

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2016-09-07 16:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-07 16:23 [PATCH] staging: ks7010: avoid dereferencing packet if it is null Colin King

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.