sunvnet: fix NULL pointer dereference
authorDavid L Stevens <david.stevens@oracle.com>
Wed, 12 Nov 2014 15:58:47 +0000 (10:58 -0500)
committerDavid S. Miller <davem@davemloft.net>
Wed, 12 Nov 2014 18:51:23 +0000 (13:51 -0500)
This patch fixes a NULL pointer dereference when __tx_port_find() doesn't
find a matching port.

Signed-off-by: David L Stevens <david.stevens@oracle.com>
Acked-by: Sowmini Varadhan <sowmini.varadhan@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/sun/sunvnet.c

index 55d66c9a6627be1a6ddc712c7bc81d38653ef887..a556eba8eeed4b5f5bc33a6617509736239660eb 100644 (file)
@@ -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;
 }