[PATCH OLK-5.10] nfsd: replace wait_on_bit by wait_on_bit_acquire in nfsd_file_acquire

hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/ICYREP ------------------------------- Due to the absence of a read barrier in wait_on_bit(), it may lead to the reading of nf->nf_file being reordered after the check for NFSD_FILE_PENDING. This could result in the reader obtaining an uninitialized nf->nf_file and using it, thereby triggering a null pointer dereference. Fixes: 65294c1f2c5e ("nfsd: add a new struct file caching facility to nfsd") Signed-off-by: Li Lingfeng <lilingfeng3@huawei.com> --- fs/nfsd/filecache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/nfsd/filecache.c b/fs/nfsd/filecache.c index e30e1ddc1ace..957d7fc37d06 100644 --- a/fs/nfsd/filecache.c +++ b/fs/nfsd/filecache.c @@ -974,7 +974,7 @@ nfsd_file_acquire(struct svc_rqst *rqstp, struct svc_fh *fhp, nfsd_file_slab_free(&new->nf_rcu); wait_for_construction: - wait_on_bit(&nf->nf_flags, NFSD_FILE_PENDING, TASK_UNINTERRUPTIBLE); + wait_on_bit_acquire(&nf->nf_flags, NFSD_FILE_PENDING, TASK_UNINTERRUPTIBLE); /* Did construction of this file fail? */ if (!test_bit(NFSD_FILE_HASHED, &nf->nf_flags)) { -- 2.46.1

反馈: 您发送到kernel@openeuler.org的补丁/补丁集,已成功转换为PR! PR链接地址: https://gitee.com/openeuler/kernel/pulls/18099 邮件列表地址:https://mailweb.openeuler.org/archives/list/kernel@openeuler.org/message/O6F... FeedBack: The patch(es) which you have sent to kernel@openeuler.org mailing list has been converted to a pull request successfully! Pull request link: https://gitee.com/openeuler/kernel/pulls/18099 Mailing list address: https://mailweb.openeuler.org/archives/list/kernel@openeuler.org/message/O6F...
participants (2)
-
Li Lingfeng
-
patchwork bot