Commit 9b37bc2c authored by Sven Eckelmann's avatar Sven Eckelmann Committed by Greg Kroah-Hartman

Staging: batman-adv: Don't dereference unchecked incoming soft_iface

send_packet derefenced forw_packet->if_incoming and checked if
forw_packet->if_incoming is NULL.

This cannot happen, but still makes irritates when reading through the
functions.
Reported-by: default avatarDan Carpenter <error27@gmail.com>
Signed-off-by: default avatarSven Eckelmann <sven.eckelmann@gmx.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 1ee600ce
...@@ -160,8 +160,8 @@ static void send_packet_to_if(struct forw_packet *forw_packet, ...@@ -160,8 +160,8 @@ static void send_packet_to_if(struct forw_packet *forw_packet,
static void send_packet(struct forw_packet *forw_packet) static void send_packet(struct forw_packet *forw_packet)
{ {
struct batman_if *batman_if; struct batman_if *batman_if;
struct net_device *soft_iface = forw_packet->if_incoming->soft_iface; struct net_device *soft_iface;
struct bat_priv *bat_priv = netdev_priv(soft_iface); struct bat_priv *bat_priv;
struct batman_packet *batman_packet = struct batman_packet *batman_packet =
(struct batman_packet *)(forw_packet->skb->data); (struct batman_packet *)(forw_packet->skb->data);
unsigned char directlink = (batman_packet->flags & DIRECTLINK ? 1 : 0); unsigned char directlink = (batman_packet->flags & DIRECTLINK ? 1 : 0);
...@@ -172,6 +172,9 @@ static void send_packet(struct forw_packet *forw_packet) ...@@ -172,6 +172,9 @@ static void send_packet(struct forw_packet *forw_packet)
return; return;
} }
soft_iface = forw_packet->if_incoming->soft_iface;
bat_priv = netdev_priv(soft_iface);
if (forw_packet->if_incoming->if_status != IF_ACTIVE) if (forw_packet->if_incoming->if_status != IF_ACTIVE)
return; return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment