From: David L Stevens Date: Wed, 12 Nov 2014 15:58:47 +0000 (-0500) Subject: sunvnet: fix NULL pointer dereference X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=c647cc3fd5ee3c3aba34a00326e684684d491de0;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git sunvnet: fix NULL pointer dereference This patch fixes a NULL pointer dereference when __tx_port_find() doesn't find a matching port. Signed-off-by: David L Stevens Acked-by: Sowmini Varadhan Signed-off-by: David S. Miller --- diff --git a/drivers/net/ethernet/sun/sunvnet.c b/drivers/net/ethernet/sun/sunvnet.c index 55d66c9a6627..a556eba8eeed 100644 --- a/drivers/net/ethernet/sun/sunvnet.c +++ b/drivers/net/ethernet/sun/sunvnet.c @@ -958,6 +958,8 @@ vnet_select_queue(struct net_device *dev, struct sk_buff *skb, struct vnet *vp = netdev_priv(dev); struct vnet_port *port = __tx_port_find(vp, skb); + if (port == NULL) + return 0; return port->q_index; }