netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] nf_conntrack_gre: nf_ct_gre_keymap_flush() fixlet
@ 2008-08-20 20:56 adobriyan
  2008-08-21 11:33 ` Patrick McHardy
  0 siblings, 1 reply; 2+ messages in thread
From: adobriyan @ 2008-08-20 20:56 UTC (permalink / raw)
  To: kaber; +Cc: netfilter-devel, netdev

It does "kfree(list_head)" which looks wrong because entity that was
allocated is definitely not list_head.

However, this all works because list_head is first item in
struct nf_ct_gre_keymap.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
---

 net/netfilter/nf_conntrack_proto_gre.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

--- a/net/netfilter/nf_conntrack_proto_gre.c
+++ b/net/netfilter/nf_conntrack_proto_gre.c
@@ -45,12 +45,12 @@ static LIST_HEAD(gre_keymap_list);
 
 void nf_ct_gre_keymap_flush(void)
 {
-	struct list_head *pos, *n;
+	struct nf_ct_gre_keymap *km, *tmp;
 
 	write_lock_bh(&nf_ct_gre_lock);
-	list_for_each_safe(pos, n, &gre_keymap_list) {
-		list_del(pos);
-		kfree(pos);
+	list_for_each_entry_safe(km, tmp, &gre_keymap_list, list) {
+		list_del(&km->list);
+		kfree(km);
 	}
 	write_unlock_bh(&nf_ct_gre_lock);
 }


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] nf_conntrack_gre: nf_ct_gre_keymap_flush() fixlet
  2008-08-20 20:56 [PATCH] nf_conntrack_gre: nf_ct_gre_keymap_flush() fixlet adobriyan
@ 2008-08-21 11:33 ` Patrick McHardy
  0 siblings, 0 replies; 2+ messages in thread
From: Patrick McHardy @ 2008-08-21 11:33 UTC (permalink / raw)
  To: adobriyan; +Cc: netfilter-devel, netdev

adobriyan@gmail.com wrote:
> It does "kfree(list_head)" which looks wrong because entity that was
> allocated is definitely not list_head.
> 
> However, this all works because list_head is first item in
> struct nf_ct_gre_keymap.

Also applied, thanks Alexey.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-08-21 11:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-20 20:56 [PATCH] nf_conntrack_gre: nf_ct_gre_keymap_flush() fixlet adobriyan
2008-08-21 11:33 ` Patrick McHardy

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).