From: David L Stevens Date: Wed, 1 Oct 2014 15:05:27 +0000 (-0400) Subject: sunvnet: fix potential NULL pointer dereference X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=a29c9c43bb633a9965909cd548879fee4aa789a4;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git sunvnet: fix potential NULL pointer dereference One of the error cases for vnet_start_xmit()'s "out_dropped" label is port == NULL, so only mess with port->clean_timer when port is not NULL. Signed-off-by: David L Stevens Signed-off-by: David S. Miller --- diff --git a/drivers/net/ethernet/sun/sunvnet.c b/drivers/net/ethernet/sun/sunvnet.c index 126269762ee7..15396720f489 100644 --- a/drivers/net/ethernet/sun/sunvnet.c +++ b/drivers/net/ethernet/sun/sunvnet.c @@ -1073,7 +1073,7 @@ out_dropped: if (pending) (void)mod_timer(&port->clean_timer, jiffies + VNET_CLEAN_TIMEOUT); - else + else if (port) del_timer(&port->clean_timer); dev->stats.tx_dropped++; return NETDEV_TX_OK;