* [PATCH] batman-adv: Fix mem leak in the batadv_tt_local_event() function
@ 2012-08-07 18:32 Jesper Juhl
[not found] ` <alpine.LNX.2.00.1208072030500.3227-h2p7t3/P30RzeRGmFJ5qR7ZzlVVXadcDXqFh9Ls21Oc@public.gmane.org>
0 siblings, 1 reply; 4+ messages in thread
From: Jesper Juhl @ 2012-08-07 18:32 UTC (permalink / raw)
To: linux-kernel
Cc: netdev, b.a.t.m.a.n, David S. Miller, Antonio Quartulli,
Simon Wunderlich, Marek Lindner
Memory is allocated for 'tt_change_node' with kmalloc().
'tt_change_node' may go out of scope really being used for anything
(except have a few members initialized) if we hit the 'del:' label.
This patch makes sure we free the memory in that case.
Signed-off-by: Jesper Juhl <jj@chaosbits.net>
---
net/batman-adv/translation-table.c | 1 +
1 file changed, 1 insertion(+)
Compile tested only.
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
index a438f4b..99dd8f7 100644
--- a/net/batman-adv/translation-table.c
+++ b/net/batman-adv/translation-table.c
@@ -197,6 +197,7 @@ static void batadv_tt_local_event(struct batadv_priv *bat_priv,
del:
list_del(&entry->list);
kfree(entry);
+ kfree(tt_change_node);
event_removed = true;
goto unlock;
}
--
1.7.11.4
--
Jesper Juhl <jj@chaosbits.net> http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.
^ permalink raw reply related [flat|nested] 4+ messages in thread[parent not found: <alpine.LNX.2.00.1208072030500.3227-h2p7t3/P30RzeRGmFJ5qR7ZzlVVXadcDXqFh9Ls21Oc@public.gmane.org>]
* Re: [PATCH] batman-adv: Fix mem leak in the batadv_tt_local_event() function [not found] ` <alpine.LNX.2.00.1208072030500.3227-h2p7t3/P30RzeRGmFJ5qR7ZzlVVXadcDXqFh9Ls21Oc@public.gmane.org> @ 2012-08-07 18:38 ` Jesper Juhl 2012-08-07 18:50 ` Antonio Quartulli 1 sibling, 0 replies; 4+ messages in thread From: Jesper Juhl @ 2012-08-07 18:38 UTC (permalink / raw) To: linux-kernel-u79uwXL29TY76Z2rM5mHXA Cc: netdev-u79uwXL29TY76Z2rM5mHXA, b.a.t.m.a.n-ZwoEplunGu2X36UT3dwllkB+6BGkLq7r, Simon Wunderlich, Marek Lindner, David S. Miller On Tue, 7 Aug 2012, Jesper Juhl wrote: > Memory is allocated for 'tt_change_node' with kmalloc(). > 'tt_change_node' may go out of scope really being used for anything This should of course read "... go out of scope without really being used ..." . > (except have a few members initialized) if we hit the 'del:' label. > This patch makes sure we free the memory in that case. > > Signed-off-by: Jesper Juhl <jj-IYz4IdjRLj0sV2N9l4h3zg@public.gmane.org> > --- > net/batman-adv/translation-table.c | 1 + > 1 file changed, 1 insertion(+) > > Compile tested only. > > diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c > index a438f4b..99dd8f7 100644 > --- a/net/batman-adv/translation-table.c > +++ b/net/batman-adv/translation-table.c > @@ -197,6 +197,7 @@ static void batadv_tt_local_event(struct batadv_priv *bat_priv, > del: > list_del(&entry->list); > kfree(entry); > + kfree(tt_change_node); > event_removed = true; > goto unlock; > } > -- Jesper Juhl <jj-IYz4IdjRLj0sV2N9l4h3zg@public.gmane.org> http://www.chaosbits.net/ Don't top-post http://www.catb.org/jargon/html/T/top-post.html Plain text mails only, please. ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] batman-adv: Fix mem leak in the batadv_tt_local_event() function [not found] ` <alpine.LNX.2.00.1208072030500.3227-h2p7t3/P30RzeRGmFJ5qR7ZzlVVXadcDXqFh9Ls21Oc@public.gmane.org> 2012-08-07 18:38 ` Jesper Juhl @ 2012-08-07 18:50 ` Antonio Quartulli [not found] ` <20120807185036.GG3891-E/2OGukznS5g9hUCZPvPmw@public.gmane.org> 1 sibling, 1 reply; 4+ messages in thread From: Antonio Quartulli @ 2012-08-07 18:50 UTC (permalink / raw) To: Jesper Juhl Cc: netdev-u79uwXL29TY76Z2rM5mHXA, b.a.t.m.a.n-ZwoEplunGu2X36UT3dwllkB+6BGkLq7r, linux-kernel-u79uwXL29TY76Z2rM5mHXA, Simon Wunderlich, Marek Lindner, David S. Miller [-- Attachment #1: Type: text/plain, Size: 605 bytes --] On Tue, Aug 07, 2012 at 08:32:34PM +0200, Jesper Juhl wrote: > Memory is allocated for 'tt_change_node' with kmalloc(). > 'tt_change_node' may go out of scope really being used for anything > (except have a few members initialized) if we hit the 'del:' label. > This patch makes sure we free the memory in that case. > > Signed-off-by: Jesper Juhl <jj-IYz4IdjRLj0sV2N9l4h3zg@public.gmane.org> Acked-by: Antonio Quartulli <ordex-GaUfNO9RBHfsrOwW+9ziJQ@public.gmane.org> Thank you very much Jepser! -- Antonio Quartulli ..each of us alone is worth nothing.. Ernesto "Che" Guevara [-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --] ^ permalink raw reply [flat|nested] 4+ messages in thread
[parent not found: <20120807185036.GG3891-E/2OGukznS5g9hUCZPvPmw@public.gmane.org>]
* Re: [PATCH] batman-adv: Fix mem leak in the batadv_tt_local_event() function [not found] ` <20120807185036.GG3891-E/2OGukznS5g9hUCZPvPmw@public.gmane.org> @ 2012-08-08 23:04 ` David Miller 0 siblings, 0 replies; 4+ messages in thread From: David Miller @ 2012-08-08 23:04 UTC (permalink / raw) To: ordex-GaUfNO9RBHfsrOwW+9ziJQ Cc: netdev-u79uwXL29TY76Z2rM5mHXA, b.a.t.m.a.n-ZwoEplunGu2X36UT3dwllkB+6BGkLq7r, linux-kernel-u79uwXL29TY76Z2rM5mHXA, siwu-MaAgPAbsBIVS8oHt8HbXEIQuADTiUCJX, jj-IYz4IdjRLj0sV2N9l4h3zg, lindner_marek-LWAfsSFWpa4 From: Antonio Quartulli <ordex-GaUfNO9RBHfsrOwW+9ziJQ@public.gmane.org> Date: Tue, 7 Aug 2012 20:50:36 +0200 > On Tue, Aug 07, 2012 at 08:32:34PM +0200, Jesper Juhl wrote: >> Memory is allocated for 'tt_change_node' with kmalloc(). >> 'tt_change_node' may go out of scope really being used for anything >> (except have a few members initialized) if we hit the 'del:' label. >> This patch makes sure we free the memory in that case. >> >> Signed-off-by: Jesper Juhl <jj-IYz4IdjRLj0sV2N9l4h3zg@public.gmane.org> > > Acked-by: Antonio Quartulli <ordex-GaUfNO9RBHfsrOwW+9ziJQ@public.gmane.org> Applied, thanks. ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-08-08 23:04 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-07 18:32 [PATCH] batman-adv: Fix mem leak in the batadv_tt_local_event() function Jesper Juhl
[not found] ` <alpine.LNX.2.00.1208072030500.3227-h2p7t3/P30RzeRGmFJ5qR7ZzlVVXadcDXqFh9Ls21Oc@public.gmane.org>
2012-08-07 18:38 ` Jesper Juhl
2012-08-07 18:50 ` Antonio Quartulli
[not found] ` <20120807185036.GG3891-E/2OGukznS5g9hUCZPvPmw@public.gmane.org>
2012-08-08 23:04 ` David Miller
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox