On Fri, Nov 25, 2016 at 8:54 PM, Eric Dumazet <eric.duma...@gmail.com> wrote: > > Oh well, this wont work, since sk->sk_destruct will be called from RCU > callback. > > Grabbing the mutex should not be done from netlink_sock_destruct() but > from netlink_release()
But you also change the behavior of cb.done(), currently it is called when the last sock ref is gone, with your patch it is called when the first sock is closed. No? I don't see why we need to get genl_lock in ->done() here, because we are already the last sock using it and module ref protects the ops from being removed via module, seems we are pretty safe without any lock.