Skip to content

Commit 62a063b

Browse files
author
J. Bruce Fields
committed
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 e195ca6) 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>
1 parent b8db159 commit 62a063b

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

fs/nfsd/nfsctl.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1126,6 +1126,8 @@ static ssize_t write_v4_end_grace(struct file *file, char *buf, size_t size)
11261126
case 'Y':
11271127
case 'y':
11281128
case '1':
1129+
if (nn->nfsd_serv)
1130+
return -EBUSY;
11291131
nfsd4_end_grace(nn);
11301132
break;
11311133
default:

0 commit comments

Comments
 (0)