From: Kurt Manucredo <fuzzybritches0@gmail.com>
To: trond.myklebust@hammerspace.com, anna.schumaker@netapp.com,
bfields@fieldses.org, chuck.lever@oracle.com,
davem@davemloft.net, kuba@kernel.org, skhan@linuxfoundation.org
Cc: Kurt Manucredo <fuzzybritches0@gmail.com>,
linux-nfs@vger.kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org,
linux-kernel-mentees@lists.linuxfoundation.org,
syzbot+ba2e91df8f74809417fa@syzkaller.appspotmail.com,
gregkh@linuxfoundation.org
Subject: [PATCH] net: sunrpc: xprt.c: fix shift-out-of-bounds in xprt_calc_majortimeo
Date: Mon, 19 Apr 2021 16:36:03 +0000 [thread overview]
Message-ID: <20210419163603.7-1-fuzzybritches0@gmail.com> (raw)
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@syzkaller.appspotmail.com
Signed-off-by: Kurt Manucredo <fuzzybritches0@gmail.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
next reply other threads:[~2021-04-19 16:37 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-19 16:36 Kurt Manucredo [this message]
2021-04-19 16:58 ` Trond Myklebust
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210419163603.7-1-fuzzybritches0@gmail.com \
--to=fuzzybritches0@gmail.com \
--cc=anna.schumaker@netapp.com \
--cc=bfields@fieldses.org \
--cc=chuck.lever@oracle.com \
--cc=davem@davemloft.net \
--cc=gregkh@linuxfoundation.org \
--cc=kuba@kernel.org \
--cc=linux-kernel-mentees@lists.linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=skhan@linuxfoundation.org \
--cc=syzbot+ba2e91df8f74809417fa@syzkaller.appspotmail.com \
--cc=trond.myklebust@hammerspace.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®