Skip to content

Commit ac03629

Browse files
neilbrownchucklever
authored andcommitted
Revert "nfsd: fix oops when reading pool_stats before server is started"
This reverts commit 8e948c3. The reverted commit moves a test on a field protected by a mutex outside of the protection of that mutex, and so is obviously racey. Depending on how the race goes, si->serv might be NULL when dereferenced in svc_pool_stats_start(), or svc_pool_stats_stop() might unlock a mutex that hadn't been locked. This bug that the commit tried to fix has been addressed by initialising ->mutex earlier. Fixes: 8e948c3 ("nfsd: fix oops when reading pool_stats before server is started") Signed-off-by: NeilBrown <[email protected]> Reviewed-by: Jeff Layton <[email protected]> Signed-off-by: Chuck Lever <[email protected]>
1 parent e0011bc commit ac03629

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

net/sunrpc/svc_xprt.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1421,13 +1421,12 @@ static void *svc_pool_stats_start(struct seq_file *m, loff_t *pos)
14211421

14221422
dprintk("svc_pool_stats_start, *pidx=%u\n", pidx);
14231423

1424-
if (!si->serv)
1425-
return NULL;
1426-
14271424
mutex_lock(si->mutex);
14281425

14291426
if (!pidx)
14301427
return SEQ_START_TOKEN;
1428+
if (!si->serv)
1429+
return NULL;
14311430
return pidx > si->serv->sv_nrpools ? NULL
14321431
: &si->serv->sv_pools[pidx - 1];
14331432
}
@@ -1459,8 +1458,7 @@ static void svc_pool_stats_stop(struct seq_file *m, void *p)
14591458
{
14601459
struct svc_info *si = m->private;
14611460

1462-
if (si->serv)
1463-
mutex_unlock(si->mutex);
1461+
mutex_unlock(si->mutex);
14641462
}
14651463

14661464
static int svc_pool_stats_show(struct seq_file *m, void *p)

0 commit comments

Comments
 (0)