From: Serhat Kumral <serhatkumral1@gmail.com>
To: jgg@ziepe.ca, leon@kernel.org
Cc: linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org,
Serhat Kumral <serhatkumral1@gmail.com>
Subject: [PATCH] RDMA/mthca: Fix off-by-one in mthca_map_user_db()
Date: Fri, 23 Oct 2026 22:23:48 +0300 [thread overview]
Message-ID: <20261023192348.11070-1-serhatkumral1@gmail.com> (raw)
db_tab->page[] has uarc_size / MTHCA_ICM_PAGE_SIZE elements, so valid
doorbell indices are in the range [0, uarc_size / 8 - 1]. Allowing
index == uarc_size / 8 results in an out-of-bounds access at
db_tab->page[npages]. Use '>=' instead of '>' in the bounds check.
Fixes: 56483ec1b702 ("[PATCH] IB uverbs: add mthca user doorbell record support")
Signed-off-by: Serhat Kumral <serhatkumral1@gmail.com>
---
drivers/infiniband/hw/mthca/mthca_memfree.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/infiniband/hw/mthca/mthca_memfree.c b/drivers/infiniband/hw/mthca/mthca_memfree.c
index 9c5eb03f354d..39d82dc73807 100644
--- a/drivers/infiniband/hw/mthca/mthca_memfree.c
+++ b/drivers/infiniband/hw/mthca/mthca_memfree.c
@@ -453,7 +453,7 @@ int mthca_map_user_db(struct mthca_dev *dev, struct mthca_uar *uar,
if (!mthca_is_memfree(dev))
return 0;
- if (index < 0 || index > dev->uar_table.uarc_size / 8)
+ if (index < 0 || index >= dev->uar_table.uarc_size / 8)
return -EINVAL;
mutex_lock(&db_tab->mutex);
--
2.53.0
next reply other threads:[~2026-10-23 19:25 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-23 19:23 Serhat Kumral [this message]
2026-10-26 2:49 ` Chenguang Zhao
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=20261023192348.11070-1-serhatkumral1@gmail.com \
--to=serhatkumral1@gmail.com \
--cc=jgg@ziepe.ca \
--cc=leon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
/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®