Commit 1da38549 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'nfsd-5.15-3' of git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux

Pull nfsd fixes from Chuck Lever:
 "Bug fixes for NFSD error handling paths"

* tag 'nfsd-5.15-3' of git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux:
  NFSD: Keep existing listeners on portlist error
  SUNRPC: fix sign error causing rpcsec_gss drops
  nfsd: Fix a warning for nfsd_file_close_inode
  nfsd4: Handle the NFSv4 READDIR 'dircount' hint being zero
  nfsd: fix error handling of register_pernet_subsys() in init_nfsd()
parents 3e899c72 c2010694
...@@ -542,7 +542,7 @@ nfsd_file_close_inode_sync(struct inode *inode) ...@@ -542,7 +542,7 @@ nfsd_file_close_inode_sync(struct inode *inode)
} }
/** /**
* nfsd_file_close_inode_sync - attempt to forcibly close a nfsd_file * nfsd_file_close_inode - attempt a delayed close of a nfsd_file
* @inode: inode of the file to attempt to remove * @inode: inode of the file to attempt to remove
* *
* Walk the whole hash bucket, looking for any files that correspond to "inode". * Walk the whole hash bucket, looking for any files that correspond to "inode".
......
...@@ -3544,15 +3544,18 @@ nfsd4_encode_dirent(void *ccdv, const char *name, int namlen, ...@@ -3544,15 +3544,18 @@ nfsd4_encode_dirent(void *ccdv, const char *name, int namlen,
goto fail; goto fail;
cd->rd_maxcount -= entry_bytes; cd->rd_maxcount -= entry_bytes;
/* /*
* RFC 3530 14.2.24 describes rd_dircount as only a "hint", so * RFC 3530 14.2.24 describes rd_dircount as only a "hint", and
* let's always let through the first entry, at least: * notes that it could be zero. If it is zero, then the server
* should enforce only the rd_maxcount value.
*/ */
if (!cd->rd_dircount) if (cd->rd_dircount) {
goto fail; name_and_cookie = 4 + 4 * XDR_QUADLEN(namlen) + 8;
name_and_cookie = 4 + 4 * XDR_QUADLEN(namlen) + 8; if (name_and_cookie > cd->rd_dircount && cd->cookie_offset)
if (name_and_cookie > cd->rd_dircount && cd->cookie_offset) goto fail;
goto fail; cd->rd_dircount -= min(cd->rd_dircount, name_and_cookie);
cd->rd_dircount -= min(cd->rd_dircount, name_and_cookie); if (!cd->rd_dircount)
cd->rd_maxcount = 0;
}
cd->cookie_offset = cookie_offset; cd->cookie_offset = cookie_offset;
skip_entry: skip_entry:
......
...@@ -793,7 +793,10 @@ static ssize_t __write_ports_addxprt(char *buf, struct net *net, const struct cr ...@@ -793,7 +793,10 @@ static ssize_t __write_ports_addxprt(char *buf, struct net *net, const struct cr
svc_xprt_put(xprt); svc_xprt_put(xprt);
} }
out_err: out_err:
nfsd_destroy(net); if (!list_empty(&nn->nfsd_serv->sv_permsocks))
nn->nfsd_serv->sv_nrthreads--;
else
nfsd_destroy(net);
return err; return err;
} }
...@@ -1545,7 +1548,7 @@ static int __init init_nfsd(void) ...@@ -1545,7 +1548,7 @@ static int __init init_nfsd(void)
goto out_free_all; goto out_free_all;
return 0; return 0;
out_free_all: out_free_all:
unregister_pernet_subsys(&nfsd_net_ops); unregister_filesystem(&nfsd_fs_type);
out_free_exports: out_free_exports:
remove_proc_entry("fs/nfs/exports", NULL); remove_proc_entry("fs/nfs/exports", NULL);
remove_proc_entry("fs/nfs", NULL); remove_proc_entry("fs/nfs", NULL);
......
...@@ -645,7 +645,7 @@ static bool gss_check_seq_num(const struct svc_rqst *rqstp, struct rsc *rsci, ...@@ -645,7 +645,7 @@ static bool gss_check_seq_num(const struct svc_rqst *rqstp, struct rsc *rsci,
} }
__set_bit(seq_num % GSS_SEQ_WIN, sd->sd_win); __set_bit(seq_num % GSS_SEQ_WIN, sd->sd_win);
goto ok; goto ok;
} else if (seq_num <= sd->sd_max - GSS_SEQ_WIN) { } else if (seq_num + GSS_SEQ_WIN <= sd->sd_max) {
goto toolow; goto toolow;
} }
if (__test_and_set_bit(seq_num % GSS_SEQ_WIN, sd->sd_win)) if (__test_and_set_bit(seq_num % GSS_SEQ_WIN, sd->sd_win))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment