netlink: Do not schedule work from sk_destruct
authorHerbert Xu <herbert@gondor.apana.org.au>
Mon, 5 Dec 2016 07:28:21 +0000 (15:28 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 10 Dec 2016 18:09:39 +0000 (19:09 +0100)
commit25d9b4bb64ea964769087fc5ae09aee9c838d759
treec3b8b1d62bb4c2e38dcbb751912b00cb0ff4d1c2
parentf5dad3473d83e7b45eee4e9cc017a65b904cc38c
netlink: Do not schedule work from sk_destruct

[ Upstream commit ed5d7788a934a4b6d6d025e948ed4da496b4f12e ]

It is wrong to schedule a work from sk_destruct using the socket
as the memory reserve because the socket will be freed immediately
after the return from sk_destruct.

Instead we should do the deferral prior to sk_free.

This patch does just that.

Fixes: 707693c8a498 ("netlink: Call cb->done from a worker thread")
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Tested-by: Andrey Konovalov <andreyknvl@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/netlink/af_netlink.c