On Tue, Nov 24, 2015 at 5:10 PM, Rainer Weikusat <rweiku...@mobileactivedefense.com> wrote: > > The af_unix part of this, yes, ie, what gets allocated in > unix_create1. But neither the socket inode nor the struct sock > originally passed to unix_create. Since these are part of the same > umbrella structure, they'll both be freed as consequence of the > sock_release iput. As far as I can tell (I don't claim that I'm > necessarily right on this, this is just the result of spending ca 2h > reading the code with the problem report in mind and looking for > something which could cause it), doing a sock_hold on the unix peer of > the socket in unix_stream_sendmsg is indeed not needed, however, there's > no additional reference to the inode or the struct sock accompanying it, > ie, both of these will be freed by unix_release_sock. This also affects > unix_dgram_sendmsg. > > It's also easy to verify: Swap the unix_state_lock and > other->sk_data_ready and see if the issue still occurs. Right now (this > may change after I had some sleep as it's pretty late for me), I don't > think there's another local fix: The ->sk_data_ready accesses a > pointer after the lock taken by the code which will clear and > then later free it was released.
It seems that : int sock_wake_async(struct socket *sock, int how, int band) should really be changed to int sock_wake_async(struct socket_wq *wq, int how, int band) So that RCU rules (already present) apply safely. sk->sk_socket is inherently racy (that is : racy without using sk_callback_lock rwlock ) Other possibility would be _not_ calling sock_orphan() from unix_release_sock() -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html