From: Simon Wunderlich <sw@simonwunderlich.de>
To: b.a.t.m.a.n@lists.open-mesh.org
Subject: [B.A.T.M.A.N.] [PATCH] batman-adv: fix NULL pointer deref in batadv_find_best_neighbor
Date: Tue, 17 Dec 2013 16:35:13 +0100 [thread overview]
Message-ID: <1387294513-12541-1-git-send-email-sw@simonwunderlich.de> (raw)
If there is no best neighbor, don't dereference the NULL pointer.
Introduced by 9bb33b8d88e318c4879d37d06ad28e3e018b9036 ("batman-adv:
split tq information in neigh_node struct")
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
---
originator.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/originator.c b/originator.c
index 2243003..9fcde58 100644
--- a/originator.c
+++ b/originator.c
@@ -789,7 +789,7 @@ batadv_find_best_neighbor(struct batadv_priv *bat_priv,
best, if_outgoing) <= 0))
best = neigh;
- if (!atomic_inc_not_zero(&best->refcount))
+ if (best && !atomic_inc_not_zero(&best->refcount))
best = NULL;
rcu_read_unlock();
--
1.7.10.4
next reply other threads:[~2013-12-17 15:35 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-17 15:35 Simon Wunderlich [this message]
2013-12-25 14:15 ` [B.A.T.M.A.N.] [PATCH] batman-adv: fix NULL pointer deref in batadv_find_best_neighbor 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=1387294513-12541-1-git-send-email-sw@simonwunderlich.de \
--to=sw@simonwunderlich.de \
--cc=b.a.t.m.a.n@lists.open-mesh.org \
/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).