summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Eckelmann <sven.eckelmann@gmx.de>2010-10-19 11:59:10 +0200
committerGreg Kroah-Hartman <gregkh@suse.de>2010-10-19 10:04:16 -0700
commit9b37bc2c711b2a76ef3daa9437bbf9c58411afbd (patch)
tree745f0b7b3a736a858a920808e44e2f40647e7d9b
parent1ee600ced32c4cabaeead0a4e84a6d4c9110f82c (diff)
downloadlinux-9b37bc2c711b2a76ef3daa9437bbf9c58411afbd.tar.gz
linux-9b37bc2c711b2a76ef3daa9437bbf9c58411afbd.tar.bz2
linux-9b37bc2c711b2a76ef3daa9437bbf9c58411afbd.zip
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: Dan Carpenter <error27@gmail.com> Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/staging/batman-adv/send.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/staging/batman-adv/send.c b/drivers/staging/batman-adv/send.c
index 5d57ef5120b0..903286159b6e 100644
--- a/drivers/staging/batman-adv/send.c
+++ b/drivers/staging/batman-adv/send.c
@@ -160,8 +160,8 @@ static void send_packet_to_if(struct forw_packet *forw_packet,
static void send_packet(struct forw_packet *forw_packet)
{
struct batman_if *batman_if;
- struct net_device *soft_iface = forw_packet->if_incoming->soft_iface;
- struct bat_priv *bat_priv = netdev_priv(soft_iface);
+ struct net_device *soft_iface;
+ struct bat_priv *bat_priv;
struct batman_packet *batman_packet =
(struct batman_packet *)(forw_packet->skb->data);
unsigned char directlink = (batman_packet->flags & DIRECTLINK ? 1 : 0);
@@ -172,6 +172,9 @@ static void send_packet(struct forw_packet *forw_packet)
return;
}
+ soft_iface = forw_packet->if_incoming->soft_iface;
+ bat_priv = netdev_priv(soft_iface);
+
if (forw_packet->if_incoming->if_status != IF_ACTIVE)
return;