Skip to content

Commit

Permalink
nfsd4: fix crash on writing v4_end_grace before nfsd startup
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: J. Bruce Fields <[email protected]>
  • Loading branch information
J. Bruce Fields committed Nov 28, 2018
1 parent b8db159 commit 62a063b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions fs/nfsd/nfsctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 62a063b

Please sign in to comment.