nfsd: fix oops when reading pool_stats before server is started
Sourbh reported an oops that is triggerable by trying to read the
pool_stats procfile before nfsd had been started. Move the check for a
NULL serv in svc_pool_stats_start above the mutex acquisition, and fix
the stop routine not to unlock the mutex if there is no serv yet.
Fixes: 7b207ccd98
("svc: don't hold reference for poolstats, only mutex.")
Reported-by: Sourabh Jain <sourabhjain@linux.ibm.com>
Signed-off-by: Jeff Layton <jlayton@kernel.org>
Tested-by: Sourabh Jain <sourabhjain@linux.ibm.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
This commit is contained in:
parent
4a77c3dead
commit
8e948c365d
1 changed files with 5 additions and 3 deletions
|
@ -1421,12 +1421,13 @@ static void *svc_pool_stats_start(struct seq_file *m, loff_t *pos)
|
||||||
|
|
||||||
dprintk("svc_pool_stats_start, *pidx=%u\n", pidx);
|
dprintk("svc_pool_stats_start, *pidx=%u\n", pidx);
|
||||||
|
|
||||||
|
if (!si->serv)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
mutex_lock(si->mutex);
|
mutex_lock(si->mutex);
|
||||||
|
|
||||||
if (!pidx)
|
if (!pidx)
|
||||||
return SEQ_START_TOKEN;
|
return SEQ_START_TOKEN;
|
||||||
if (!si->serv)
|
|
||||||
return NULL;
|
|
||||||
return pidx > si->serv->sv_nrpools ? NULL
|
return pidx > si->serv->sv_nrpools ? NULL
|
||||||
: &si->serv->sv_pools[pidx - 1];
|
: &si->serv->sv_pools[pidx - 1];
|
||||||
}
|
}
|
||||||
|
@ -1458,6 +1459,7 @@ static void svc_pool_stats_stop(struct seq_file *m, void *p)
|
||||||
{
|
{
|
||||||
struct svc_info *si = m->private;
|
struct svc_info *si = m->private;
|
||||||
|
|
||||||
|
if (si->serv)
|
||||||
mutex_unlock(si->mutex);
|
mutex_unlock(si->mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue