From: Antonio Quartulli <antonio@meshcoding.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, b.a.t.m.a.n@lists.open-mesh.org,
Marek Lindner <mareklindner@neomailbox.ch>,
Antonio Quartulli <antonio@meshcoding.com>
Subject: [B.A.T.M.A.N.] [PATCH 06/10] batman-adv: fix potential orig_node reference leak
Date: Mon, 17 Feb 2014 21:48:45 +0100 [thread overview]
Message-ID: <1392670129-2498-7-git-send-email-antonio@meshcoding.com> (raw)
In-Reply-To: <1392670129-2498-1-git-send-email-antonio@meshcoding.com>
From: Simon Wunderlich <sw@simonwunderlich.de>
Since batadv_orig_node_new() sets the refcount to two, assuming that
the calling function will use a reference for putting the orig_node into
a hash or similar, both references must be freed if initialization of
the orig_node fails. Otherwise that object may be leaked in that error
case.
Reported-by: Antonio Quartulli <antonio@meshcoding.com>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>
---
net/batman-adv/bat_iv_ogm.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c
index 094ae7c..42cbc0a 100644
--- a/net/batman-adv/bat_iv_ogm.c
+++ b/net/batman-adv/bat_iv_ogm.c
@@ -254,6 +254,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);
free_orig_node:
+ /* free twice, as batadv_orig_node_new sets refcount to 2 */
+ batadv_orig_node_free_ref(orig_node);
batadv_orig_node_free_ref(orig_node);
return NULL;
--
1.8.5.3
WARNING: multiple messages have this Message-ID (diff)
From: Antonio Quartulli <antonio@meshcoding.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, b.a.t.m.a.n@lists.open-mesh.org,
Simon Wunderlich <sw@simonwunderlich.de>,
Marek Lindner <mareklindner@neomailbox.ch>,
Antonio Quartulli <antonio@meshcoding.com>
Subject: [PATCH 06/10] batman-adv: fix potential orig_node reference leak
Date: Mon, 17 Feb 2014 21:48:45 +0100 [thread overview]
Message-ID: <1392670129-2498-7-git-send-email-antonio@meshcoding.com> (raw)
In-Reply-To: <1392670129-2498-1-git-send-email-antonio@meshcoding.com>
From: Simon Wunderlich <sw@simonwunderlich.de>
Since batadv_orig_node_new() sets the refcount to two, assuming that
the calling function will use a reference for putting the orig_node into
a hash or similar, both references must be freed if initialization of
the orig_node fails. Otherwise that object may be leaked in that error
case.
Reported-by: Antonio Quartulli <antonio@meshcoding.com>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>
---
net/batman-adv/bat_iv_ogm.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c
index 094ae7c..42cbc0a 100644
--- a/net/batman-adv/bat_iv_ogm.c
+++ b/net/batman-adv/bat_iv_ogm.c
@@ -254,6 +254,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);
free_orig_node:
+ /* free twice, as batadv_orig_node_new sets refcount to 2 */
+ batadv_orig_node_free_ref(orig_node);
batadv_orig_node_free_ref(orig_node);
return NULL;
--
1.8.5.3
next prev parent reply other threads:[~2014-02-17 20:48 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-17 20:48 [B.A.T.M.A.N.] [PATCH 00/10] pull request net: batman-adv 2014-02-17 Antonio Quartulli
2014-02-17 20:48 ` Antonio Quartulli
2014-02-17 20:48 ` [B.A.T.M.A.N.] [PATCH 01/10] batman-adv: fix soft-interface MTU computation Antonio Quartulli
2014-02-17 20:48 ` Antonio Quartulli
2014-02-17 21:13 ` [B.A.T.M.A.N.] " David Miller
2014-02-17 21:13 ` David Miller
2014-02-18 6:44 ` [B.A.T.M.A.N.] " Antonio Quartulli
2014-02-18 18:22 ` David Miller
2014-02-18 18:22 ` David Miller
2014-02-18 20:41 ` David Miller
2014-02-18 20:41 ` David Miller
2014-02-18 20:57 ` Antonio Quartulli
2014-02-18 20:57 ` Antonio Quartulli
2014-02-17 20:48 ` [B.A.T.M.A.N.] [PATCH 02/10] batman-adv: fix TT-TVLV parsing on OGM reception Antonio Quartulli
2014-02-17 20:48 ` Antonio Quartulli
2014-02-17 20:48 ` [B.A.T.M.A.N.] [PATCH 03/10] batman-adv: release vlan object after checking the CRC Antonio Quartulli
2014-02-17 20:48 ` Antonio Quartulli
2014-02-17 20:48 ` [B.A.T.M.A.N.] [PATCH 04/10] batman-adv: properly check pskb_may_pull return value Antonio Quartulli
2014-02-17 20:48 ` Antonio Quartulli
2014-02-17 20:48 ` [B.A.T.M.A.N.] [PATCH 05/10] batman-adv: avoid potential race condition when adding a new neighbour Antonio Quartulli
2014-02-17 20:48 ` Antonio Quartulli
2014-02-17 20:48 ` Antonio Quartulli [this message]
2014-02-17 20:48 ` [PATCH 06/10] batman-adv: fix potential orig_node reference leak Antonio Quartulli
2014-02-17 20:48 ` [B.A.T.M.A.N.] [PATCH 07/10] batman-adv: fix TT CRC computation by ensuring byte order Antonio Quartulli
2014-02-17 20:48 ` Antonio Quartulli
2014-02-17 20:48 ` [B.A.T.M.A.N.] [PATCH 08/10] batman-adv: free skb on TVLV parsing success Antonio Quartulli
2014-02-17 20:48 ` Antonio Quartulli
2014-02-17 20:48 ` [B.A.T.M.A.N.] [PATCH 09/10] batman-adv: avoid double free when orig_node initialization fails Antonio Quartulli
2014-02-17 20:48 ` Antonio Quartulli
2014-02-17 20:48 ` [B.A.T.M.A.N.] [PATCH 10/10] batman-adv: fix potential kernel paging error for unicast transmissions Antonio Quartulli
2014-02-17 20:48 ` Antonio Quartulli
2014-02-21 7:47 ` [B.A.T.M.A.N.] [PATCH 00/10] pull request net: batman-adv 2014-02-17 Antonio Quartulli
2014-02-21 7:47 ` Antonio Quartulli
2014-02-25 20:36 ` [B.A.T.M.A.N.] " David Miller
2014-02-25 20:36 ` David Miller
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=1392670129-2498-7-git-send-email-antonio@meshcoding.com \
--to=antonio@meshcoding.com \
--cc=b.a.t.m.a.n@lists.open-mesh.org \
--cc=davem@davemloft.net \
--cc=mareklindner@neomailbox.ch \
--cc=netdev@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.