Subject: [PATCH net-next] sunvnet: fix NULL pointer dereference

From: David L Stevens <[email-masked]>
Date: Wed, 12 Nov 2014 10:58:47 -0500

This patch fixes a NULL pointer dereference when __tx_port_find() doesn't
find a matching port.

Signed-off-by: David L Stevens <[email-masked]>
---
 drivers/net/ethernet/sun/sunvnet.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/net/ethernet/sun/sunvnet.c b/drivers/net/ethernet/sun/sunvnet.c
index 55d66c9..a556eba 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;
 }
 
-- 
1.7.1