Re: [PATCH] igmp: fix ip_mc_sf_allow race
From: Eric Dumazet <hidden>
Date: 2010-01-04 13:07:10
From: Eric Dumazet <hidden>
Date: 2010-01-04 13:07:10
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())