[<prev] [next>] [day] [month] [year] [list]
Message-ID:
<SYBPR01MB7881B6EB04F61932303DC359AFA9A@SYBPR01MB7881.ausprd01.prod.outlook.com>
Date: Fri, 19 Dec 2025 18:08:47 +0800
From: Junrui Luo <moonafterrain@...look.com>
To: Brad Warrum <bwarrum@...ux.ibm.com>,
Ritu Agarwal <rituagar@...ux.ibm.com>, Arnd Bergmann <arnd@...db.de>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Adam Reznechek <adreznec@...ux.vnet.ibm.com>,
"Bryant G. Ly" <bryantly@...ux.vnet.ibm.com>,
Steven Royer <seroyer@...ux.vnet.ibm.com>,
Randy Dunlap <rdunlap@...radead.org>
Cc: linux-kernel@...r.kernel.org, Yuhao Jiang <danisjiang@...il.com>,
Junrui Luo <moonafterrain@...look.com>
Subject: [PATCH] misc: ibmvmc: fix integer underflow in max_hmc_index
calculation
The ibmvmc_process_capabilities() function contains an integer underflow
vulnerability that may trigger out-of-bounds memory access in the kernel.
When processing a VMC_MSG_CAP_RESP message, if the hypervisor sets
max_hmc to 0, the following calculation causes an integer underflow:
ibmvmc.max_hmc_index = min_t(u8, ibmvmc_max_hmcs, crq->max_hmc) - 1;
Fix by adding validation to ensure max_hmc is at least 1 before the
subtraction.
Reported-by: Yuhao Jiang <danisjiang@...il.com>
Reported-by: Junrui Luo <moonafterrain@...look.com>
Fixes: 0eca353e7ae7 ("misc: IBM Virtual Management Channel Driver (VMC)")
Signed-off-by: Junrui Luo <moonafterrain@...look.com>
---
drivers/misc/ibmvmc.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/misc/ibmvmc.c b/drivers/misc/ibmvmc.c
index e5f935b5249d..5848d93ace4f 100644
--- a/drivers/misc/ibmvmc.c
+++ b/drivers/misc/ibmvmc.c
@@ -1711,6 +1711,12 @@ static void ibmvmc_process_capabilities(struct crq_server_adapter *adapter,
return;
}
+ if (crq->max_hmc == 0) {
+ dev_err(adapter->dev, "init failed, invalid max_hmc value of 0\n");
+ ibmvmc.state = ibmvmc_state_failed;
+ return;
+ }
+
ibmvmc.max_mtu = min_t(u32, ibmvmc_max_mtu, be32_to_cpu(crq->max_mtu));
ibmvmc.max_buffer_pool_size = min_t(u16, ibmvmc_max_buf_pool_size,
be16_to_cpu(crq->pool_size));
---
base-commit: ea1013c1539270e372fc99854bc6e4d94eaeff66
change-id: 20251219-fixes-591c346c9599
Best regards,
--
Junrui Luo <moonafterrain@...look.com>
Powered by blists - more mailing lists