Skip to content

Commit e404fa9

Browse files
author
Olga Kornievskaia
committed
nfsd: no need get cache ref when protected by rcu
JIRA: https://issues.redhat.com/browse/RHEL-80508 CVE: CVE-2024-53216 commit c224edc Author: Yang Erkun <yangerkun@huawei.com> Date: Wed Dec 25 14:59:06 2024 +0800 nfsd: no need get cache ref when protected by rcu rcu_read_lock/rcu_read_unlock has already provide protection for the pointer we will reference when we call e_show. Therefore, there is no need to obtain a cache reference to help protect cache_head. Additionally, the .put such as expkey_put/svc_export_put will invoke dput, which can sleep and break rcu. Stop get cache reference to fix them all. Fixes: ae74136 ("SUNRPC: Allow cache lookups to use RCU protection rather than the r/w spinlock") Suggested-by: NeilBrown <neilb@suse.de> Signed-off-by: Yang Erkun <yangerkun@huawei.com> Reviewed-by: Jeff Layton <jlayton@kernel.org> Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Olga Kornievskaia <okorniev@redhat.com>
1 parent 6906894 commit e404fa9

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

fs/nfsd/export.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1431,13 +1431,9 @@ static int e_show(struct seq_file *m, void *p)
14311431
return 0;
14321432
}
14331433

1434-
if (!cache_get_rcu(&exp->h))
1434+
if (cache_check_rcu(cd, &exp->h, NULL))
14351435
return 0;
14361436

1437-
if (cache_check(cd, &exp->h, NULL))
1438-
return 0;
1439-
1440-
exp_put(exp);
14411437
return svc_export_show(m, cd, cp);
14421438
}
14431439

0 commit comments

Comments
 (0)