From: Murad Masimov <m.masimov@maxima.ru>
To: Mustafa Ismail <mustafa.ismail@intel.com>
Cc: Murad Masimov <m.masimov@maxima.ru>,
Tatyana Nikolova <tatyana.e.nikolova@intel.com>,
Jason Gunthorpe <jgg@ziepe.ca>, Leon Romanovsky <leon@kernel.org>,
Shiraz Saleem <shiraz.saleem@intel.com>,
<linux-rdma@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<lvc-project@linuxtesting.org>
Subject: [PATCH] RDMA/irdma: prevent out-of-bounds shift on timeout calculation
Date: Thu, 21 Nov 2024 00:18:07 +0300 [thread overview]
Message-ID: <20241120211809.922-1-m.masimov@maxima.ru> (raw)
After some finite number of tries, bitshift in the calculation of timetosend at
function irdma_cm_timer_tick() will lead to out-of-bounds shift, which in this
case is an undefined behaviour. For instance, if HZ is equal to 1024, the issue
occurs after 21 tries, which will take less than
IRDMA_MAX_TIMEOUT / HZ * 21 = 252 seconds.
Lower IRDMA_DEFAULT_RETRANS from 32 to 20 to prevent out-of-bounds shift for
any HZ value less than 2048.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Fixes: 8385a875c9ee ("RDMA/irdma: Increase iWARP CM default rexmit count")
Signed-off-by: Murad Masimov <m.masimov@maxima.ru>
---
drivers/infiniband/hw/irdma/cm.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/infiniband/hw/irdma/cm.h b/drivers/infiniband/hw/irdma/cm.h
index 48ee285cf745..dc4ee1b185eb 100644
--- a/drivers/infiniband/hw/irdma/cm.h
+++ b/drivers/infiniband/hw/irdma/cm.h
@@ -41,7 +41,7 @@
#define TCP_OPTIONS_PADDING 3
#define IRDMA_DEFAULT_RETRYS 64
-#define IRDMA_DEFAULT_RETRANS 32
+#define IRDMA_DEFAULT_RETRANS 20
#define IRDMA_DEFAULT_TTL 0x40
#define IRDMA_DEFAULT_RTT_VAR 6
#define IRDMA_DEFAULT_SS_THRESH 0x3fffffff
--
2.39.2
reply other threads:[~2024-11-20 21:18 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20241120211809.922-1-m.masimov@maxima.ru \
--to=m.masimov@maxima.ru \
--cc=jgg@ziepe.ca \
--cc=leon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=lvc-project@linuxtesting.org \
--cc=mustafa.ismail@intel.com \
--cc=shiraz.saleem@intel.com \
--cc=tatyana.e.nikolova@intel.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®