]> git.baikalelectronics.ru Git - kernel.git/commit
race of nfsd inetaddr notifiers vs nn->nfsd_serv change
authorVasily Averin <vvs@virtuozzo.com>
Fri, 10 Nov 2017 07:19:35 +0000 (10:19 +0300)
committerJ. Bruce Fields <bfields@redhat.com>
Mon, 27 Nov 2017 21:45:11 +0000 (16:45 -0500)
commitcb12a44368073f73899fd13e1dd2f9c2d5db3e58
tree9854e4dff8bb6981a73aca72427187d3afea4d52
parentce8ee0bf1f82a260f1956ff6f6371b77bf40d298
race of nfsd inetaddr notifiers vs nn->nfsd_serv change

nfsd_inet[6]addr_event uses nn->nfsd_serv without taking nfsd_mutex,
which can be changed during execution of notifiers and crash the host.

Moreover if notifiers were enabled in one net namespace they are enabled
in all other net namespaces, from creation until destruction.

This patch allows notifiers to access nn->nfsd_serv only after the
pointer is correctly initialized and delays cleanup until notifiers are
no longer in use.

Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
Tested-by: Scott Mayhew <smayhew@redhat.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
fs/nfsd/netns.h
fs/nfsd/nfsctl.c
fs/nfsd/nfssvc.c