[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210419163603.7-1-fuzzybritches0@gmail.com>
Date: Mon, 19 Apr 2021 16:36:03 +0000
From: Kurt Manucredo <fuzzybritches0@...il.com>
To: trond.myklebust@...merspace.com, anna.schumaker@...app.com,
bfields@...ldses.org, chuck.lever@...cle.com, davem@...emloft.net,
kuba@...nel.org, skhan@...uxfoundation.org
Cc: Kurt Manucredo <fuzzybritches0@...il.com>,
linux-nfs@...r.kernel.org, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org,
linux-kernel-mentees@...ts.linuxfoundation.org,
syzbot+ba2e91df8f74809417fa@...kaller.appspotmail.com,
gregkh@...uxfoundation.org
Subject: [PATCH] net: sunrpc: xprt.c: fix shift-out-of-bounds in xprt_calc_majortimeo
Fix shift-out-of-bounds in xprt_calc_majortimeo().
UBSAN: shift-out-of-bounds in net/sunrpc/xprt.c:658:14
shift exponent 536871232 is too large for 64-bit type 'long u
Reported-by: syzbot+ba2e91df8f74809417fa@...kaller.appspotmail.com
Signed-off-by: Kurt Manucredo <fuzzybritches0@...il.com>
---
net/sunrpc/xprt.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c
index 691ccf8049a4..07128ac3d51d 100644
--- a/net/sunrpc/xprt.c
+++ b/net/sunrpc/xprt.c
@@ -655,7 +655,10 @@ static unsigned long xprt_calc_majortimeo(struct rpc_rqst *req)
unsigned long majortimeo = req->rq_timeout;
if (to->to_exponential)
- majortimeo <<= to->to_retries;
+ if (to->to_retries >= sizeof(majortimeo) * 8)
+ majortimeo = to->to_maxval;
+ else
+ majortimeo <<= to->to_retries;
else
majortimeo += to->to_increment * to->to_retries;
if (majortimeo > to->to_maxval || majortimeo == 0)
--
2.30.2
Powered by blists - more mailing lists