summaryrefslogtreecommitdiffstats
path: root/fs/nfsd
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@redhat.com>2018-11-27 15:54:17 -0500
committerJ. Bruce Fields <bfields@redhat.com>2018-11-28 18:36:02 -0500
commit62a063b8e7d1db684db3f207261a466fa3194e72 (patch)
tree643a3756a10752a30ee9f037375681c49b6c30b2 /fs/nfsd
parentb8db159239b3f51e2b909859935cc25cb3ff3eed (diff)
downloadlinux-62a063b8e7d1db684db3f207261a466fa3194e72.tar.gz
linux-62a063b8e7d1db684db3f207261a466fa3194e72.tar.bz2
linux-62a063b8e7d1db684db3f207261a466fa3194e72.zip
nfsd4: fix crash on writing v4_end_grace before nfsd startup
Anatoly Trosinenko reports that this: 1) Checkout fresh master Linux branch (tested with commit e195ca6cb) 2) Copy x84_64-config-4.14 to .config, then enable NFS server v4 and build 3) From `kvm-xfstests shell`: results in NULL dereference in locks_end_grace. Check that nfsd has been started before trying to end the grace period. Reported-by: Anatoly Trosinenko <anatoly.trosinenko@gmail.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/nfsd')
-rw-r--r--fs/nfsd/nfsctl.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
index 6384c9b94898..b33f9785b756 100644
--- a/fs/nfsd/nfsctl.c
+++ b/fs/nfsd/nfsctl.c
@@ -1126,6 +1126,8 @@ static ssize_t write_v4_end_grace(struct file *file, char *buf, size_t size)
case 'Y':
case 'y':
case '1':
+ if (nn->nfsd_serv)
+ return -EBUSY;
nfsd4_end_grace(nn);
break;
default: