tipc: avoid packets leaking on socket receive queue
authorYing Xue <ying.xue@windriver.com>
Sun, 22 Nov 2015 07:46:05 +0000 (15:46 +0800)
committerDavid S. Miller <davem@davemloft.net>
Tue, 24 Nov 2015 04:45:15 +0000 (23:45 -0500)
commitf4195d1eac954a67adf112dd53404560cc55b942
tree24c560dbc1ff6913630583db925d07ae292f55b1
parent3c25a860d17b7378822f35d8c9141db9507e3beb
tipc: avoid packets leaking on socket receive queue

Even if we drain receive queue thoroughly in tipc_release() after tipc
socket is removed from rhashtable, it is possible that some packets
are in flight because some CPU runs receiver and did rhashtable lookup
before we removed socket. They will achieve receive queue, but nobody
delete them at all. To avoid this leak, we register a private socket
destructor to purge receive queue, meaning releasing packets pending
on receive queue will be delayed until the last reference of tipc
socket will be released.

Signed-off-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/tipc/socket.c