[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <2025121804-angles-driller-7c7c@gregkh>
Date: Thu, 18 Dec 2025 15:57:49 +0100
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: Junrui Luo <moonafterrain@...look.com>
Cc: Brad Warrum <bwarrum@...ux.ibm.com>,
Ritu Agarwal <rituagar@...ux.ibm.com>,
Arnd Bergmann <arnd@...db.de>,
Adam Reznechek <adreznec@...ux.vnet.ibm.com>,
Steven Royer <seroyer@...ux.vnet.ibm.com>,
"Bryant G. Ly" <bryantly@...ux.vnet.ibm.com>,
Randy Dunlap <rdunlap@...radead.org>, linux-kernel@...r.kernel.org,
Yuhao Jiang <danisjiang@...il.com>
Subject: Re: [PATCH] misc: ibmvmc: fix buffer overflow in ibmvmc_recv_msg()
On Thu, Dec 18, 2025 at 10:43:11PM +0800, Junrui Luo wrote:
> The ibmvmc_recv_msg() function receives a msg_len value from the
> hypervisor and uses it directly in h_copy_rdma() without validating.
> This can result a buffer overflow.
>
> Add a check to ensure msg_len does not exceed buffer->size before
> calling h_copy_rdma().
>
> 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..e583a73a3592 100644
> --- a/drivers/misc/ibmvmc.c
> +++ b/drivers/misc/ibmvmc.c
> @@ -1654,6 +1654,12 @@ static int ibmvmc_recv_msg(struct crq_server_adapter *adapter,
> }
>
> /* RDMA the data into the partition. */
> + if (msg_len > buffer->size) {
> + dev_err(adapter->dev, "Recv_msg: msg_len 0x%x exceeds buffer size 0x%x\n",
> + (unsigned int)msg_len, (unsigned int)buffer->size);
Don't allow broken hardware to spam the kernel log. Make this a
debugging message instead.
And place the check above the comment?
thanks,
greg k-h
Powered by blists - more mailing lists