From: Antonio Quartulli <antonio@meshcoding.com>
To: b.a.t.m.a.n@lists.open-mesh.org
Cc: Antonio Quartulli <antonio@meshcoding.com>
Subject: [B.A.T.M.A.N.] [PATCH maint] batman-adv: avoid double free when orig_node initialization fails
Date: Tue, 11 Feb 2014 20:00:35 +0100 [thread overview]
Message-ID: <1392145235-3914-1-git-send-email-antonio@meshcoding.com> (raw)
In the failure path of the orig_node initialization routine
a double free is hit because orig_node->bat_iv.bcast_own is
not set to NULL after being free'd.
Fix it by setting bcast_own to NULL after having free'd it.
Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>
---
bat_iv_ogm.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/bat_iv_ogm.c b/bat_iv_ogm.c
index c07e59f..cb4c18a 100644
--- a/bat_iv_ogm.c
+++ b/bat_iv_ogm.c
@@ -255,6 +255,8 @@ batadv_iv_ogm_orig_get(struct batadv_priv *bat_priv, const uint8_t *addr)
free_bcast_own:
kfree(orig_node->bat_iv.bcast_own);
+ /* make it NULL to avoid second free in batadv_iv_ogm_orig_free() */
+ orig_node->bat_iv.bcast_own = NULL;
free_orig_node:
/* free twice, as batadv_orig_node_new sets refcount to 2 */
batadv_orig_node_free_ref(orig_node);
--
1.8.5.3
reply other threads:[~2014-02-11 19:00 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1392145235-3914-1-git-send-email-antonio@meshcoding.com \
--to=antonio@meshcoding.com \
--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