lockd: lost rollback of set_grace_period() in lockd_down_net()
authorVasily Averin <vvs@virtuozzo.com>
Thu, 2 Nov 2017 10:03:42 +0000 (13:03 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 5 Dec 2017 10:26:30 +0000 (11:26 +0100)
commit84779085fa10014b9e8208d7e71b54bced73075c
treea30c589353e19f2e30f7ce35f74775780b9e98a3
parent861eae231b0437427676a4ed323d31097002d5a2
lockd: lost rollback of set_grace_period() in lockd_down_net()

commit 3a2b19d1ee5633f76ae8a88da7bc039a5d1732aa upstream.

Commit efda760fe95ea ("lockd: fix lockd shutdown race") is incorrect,
it removes lockd_manager and disarm grace_period_end for init_net only.

If nfsd was started from another net namespace lockd_up_net() calls
set_grace_period() that adds lockd_manager into per-netns list
and queues grace_period_end delayed work.

These action should be reverted in lockd_down_net().
Otherwise it can lead to double list_add on after restart nfsd in netns,
and to use-after-free if non-disarmed delayed work will be executed after netns destroy.

Fixes: efda760fe95e ("lockd: fix lockd shutdown race")
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/lockd/svc.c