From: Sven Eckelmann <sven.eckelmann@gmx.de>
To: b.a.t.m.a.n@lists.open-mesh.org
Cc: error27@gmail.com
Subject: [B.A.T.M.A.N.] [PATCH] batman-adv: Don't dereference unchecked incoming soft_iface
Date: Sat, 9 Oct 2010 02:19:42 +0200 [thread overview]
Message-ID: <1286583582-13275-1-git-send-email-sven.eckelmann@gmx.de> (raw)
In-Reply-To: <20101008093941.GH11681@bicker>
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>
---
batman-adv/send.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/batman-adv/send.c b/batman-adv/send.c
index 625a3ba..7097ff0 100644
--- a/batman-adv/send.c
+++ b/batman-adv/send.c
@@ -163,8 +163,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);
@@ -175,6 +175,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;
--
1.7.2.3
next parent reply other threads:[~2010-10-09 0:19 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20101008093941.GH11681@bicker>
2010-10-09 0:19 ` Sven Eckelmann [this message]
2010-10-09 11:51 ` [B.A.T.M.A.N.] [PATCH] batman-adv: Don't dereference unchecked incoming soft_iface Marek Lindner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1286583582-13275-1-git-send-email-sven.eckelmann@gmx.de \
--to=sven.eckelmann@gmx.de \
--cc=b.a.t.m.a.n@lists.open-mesh.org \
--cc=error27@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).