From 1d50109a693c22ea6ac80991ae492ea9e1423a23 Mon Sep 17 00:00:00 2001 From: Trond Myklebust Date: Thu, 29 Apr 2021 14:56:21 +0800 Subject: [PATCH] SUNRPC: Don't allow compiler optimisation of svc_xprt_release_slot() mainline inclusion from mainline-5.1-rc1 commit 1602a7b7d33741d0490682e620bb29e96ad684d7 category: bugfix bugzilla: 51818 CVE: NA ------------------------------------------------- Use READ_ONCE() to tell the compiler to not optimse away the read of xprt->xpt_flags in svc_xprt_release_slot(). Signed-off-by: Trond Myklebust Signed-off-by: J. Bruce Fields Signed-off-by: Zhang Changzhong Reviewed-by: Yue Haibing Signed-off-by: Yang Yingliang --- net/sunrpc/svc_xprt.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/net/sunrpc/svc_xprt.c b/net/sunrpc/svc_xprt.c index 0f89fc6c92e2..0ab649e02861 100644 --- a/net/sunrpc/svc_xprt.c +++ b/net/sunrpc/svc_xprt.c @@ -373,9 +373,13 @@ static void svc_xprt_release_slot(struct svc_rqst *rqstp) static bool svc_xprt_has_something_to_do(struct svc_xprt *xprt) { - if (xprt->xpt_flags & ((1<xpt_flags); + + if (xpt_flags & (BIT(XPT_CONN) | BIT(XPT_CLOSE))) return true; - if (xprt->xpt_flags & ((1<xpt_ops->xpo_has_wspace(xprt) && svc_xprt_slots_in_range(xprt)) return true; -- GitLab