netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Flavio Leitner <fbl@sysclose.org>
Cc: David Miller <davem@davemloft.net>, netdev@vger.kernel.org
Subject: Re: [PATCH] igmp: fix ip_mc_sf_allow race
Date: Mon, 04 Jan 2010 14:07:03 +0100	[thread overview]
Message-ID: <4B41E7F7.2030003@gmail.com> (raw)
In-Reply-To: <20100104112957.GA2573@sysclose.org>

Le 04/01/2010 12:29, Flavio Leitner a écrit :
 
> Then, I tried using call_rcu() to avoid the problem you are saying,
> but when you stop the reproducer, sk_free() will warn printing 
> "optmem leakage.." because the rcu callback didn't run yet.
> 
> 

This is probably because your call_rcu() callback was trying to call sock_kfree_s() ?

 		rtnl_unlock();
		call_rcu(&iml->lock, callback_func)

callback_func()
{
	sock_kfree_s(sk, iml, sizeof(*iml));
}



Take a look at sock_kfree_s() definition :

void sock_kfree_s(struct sock *sk, void *mem, int size)
{
        kfree(mem);
        atomic_sub(size, &sk->sk_omem_alloc);
}


You can certainly try :

	rtnl_unlock();
	atomic_sub(sizeof(*iml), sk->sk_omem_alloc);
	call_rcu(&iml->rcu, kfree);

(immediate sk_omem_alloc handling, but deferred kfree())


  reply	other threads:[~2010-01-04 13:07 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-30 14:23 [PATCH] igmp: fix ip_mc_sf_allow race Flavio Leitner
2010-01-04  5:54 ` David Miller
2010-01-04 11:29   ` Flavio Leitner
2010-01-04 13:07     ` Eric Dumazet [this message]
2010-01-04 18:51       ` Flavio Leitner
2010-01-04 19:53         ` Eric Dumazet
2010-01-05  0:06         ` David Stevens
2010-01-05  6:55           ` Eric Dumazet
2010-01-05 20:52             ` [PATCH] igmp: fix ip_mc_sf_allow race [v3] Flavio Leitner
2010-01-05 22:36               ` Eric Dumazet
2010-01-05 23:03               ` Stephen Hemminger
2010-01-06 16:40               ` Paul E. McKenney
2010-01-06 17:10                 ` Stephen Hemminger
2010-01-06 18:50                   ` Paul E. McKenney
2010-01-28 16:13               ` [PATCH] igmp: fix ip_mc_sf_allow race [v5] Flavio Leitner
2010-02-02 15:32                 ` 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=4B41E7F7.2030003@gmail.com \
    --to=eric.dumazet@gmail.com \
    --cc=davem@davemloft.net \
    --cc=fbl@sysclose.org \
    --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 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).