Commit 5876aa07 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'nfsd-5.8-2' of git://linux-nfs.org/~bfields/linux into master

Pull nfsd fix from Bruce Fields:
 "Just one fix for a NULL dereference if someone happens to read
  /proc/fs/nfsd/client/../state at the wrong moment"

* tag 'nfsd-5.8-2' of git://linux-nfs.org/~bfields/linux:
  nfsd4: fix NULL dereference in nfsd/clients display code
parents 68845a55 9affa435
...@@ -507,6 +507,17 @@ find_any_file(struct nfs4_file *f) ...@@ -507,6 +507,17 @@ find_any_file(struct nfs4_file *f)
return ret; return ret;
} }
static struct nfsd_file *find_deleg_file(struct nfs4_file *f)
{
struct nfsd_file *ret = NULL;
spin_lock(&f->fi_lock);
if (f->fi_deleg_file)
ret = nfsd_file_get(f->fi_deleg_file);
spin_unlock(&f->fi_lock);
return ret;
}
static atomic_long_t num_delegations; static atomic_long_t num_delegations;
unsigned long max_delegations; unsigned long max_delegations;
...@@ -2444,6 +2455,8 @@ static int nfs4_show_open(struct seq_file *s, struct nfs4_stid *st) ...@@ -2444,6 +2455,8 @@ static int nfs4_show_open(struct seq_file *s, struct nfs4_stid *st)
oo = ols->st_stateowner; oo = ols->st_stateowner;
nf = st->sc_file; nf = st->sc_file;
file = find_any_file(nf); file = find_any_file(nf);
if (!file)
return 0;
seq_printf(s, "- "); seq_printf(s, "- ");
nfs4_show_stateid(s, &st->sc_stateid); nfs4_show_stateid(s, &st->sc_stateid);
...@@ -2481,6 +2494,8 @@ static int nfs4_show_lock(struct seq_file *s, struct nfs4_stid *st) ...@@ -2481,6 +2494,8 @@ static int nfs4_show_lock(struct seq_file *s, struct nfs4_stid *st)
oo = ols->st_stateowner; oo = ols->st_stateowner;
nf = st->sc_file; nf = st->sc_file;
file = find_any_file(nf); file = find_any_file(nf);
if (!file)
return 0;
seq_printf(s, "- "); seq_printf(s, "- ");
nfs4_show_stateid(s, &st->sc_stateid); nfs4_show_stateid(s, &st->sc_stateid);
...@@ -2513,7 +2528,9 @@ static int nfs4_show_deleg(struct seq_file *s, struct nfs4_stid *st) ...@@ -2513,7 +2528,9 @@ static int nfs4_show_deleg(struct seq_file *s, struct nfs4_stid *st)
ds = delegstateid(st); ds = delegstateid(st);
nf = st->sc_file; nf = st->sc_file;
file = nf->fi_deleg_file; file = find_deleg_file(nf);
if (!file)
return 0;
seq_printf(s, "- "); seq_printf(s, "- ");
nfs4_show_stateid(s, &st->sc_stateid); nfs4_show_stateid(s, &st->sc_stateid);
...@@ -2529,6 +2546,7 @@ static int nfs4_show_deleg(struct seq_file *s, struct nfs4_stid *st) ...@@ -2529,6 +2546,7 @@ static int nfs4_show_deleg(struct seq_file *s, struct nfs4_stid *st)
seq_printf(s, ", "); seq_printf(s, ", ");
nfs4_show_fname(s, file); nfs4_show_fname(s, file);
seq_printf(s, " }\n"); seq_printf(s, " }\n");
nfsd_file_put(file);
return 0; return 0;
} }
......
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