From: Greg KH <gregkh@linuxfoundation.org>
To: Yi Liu <liuy22@mails.tsinghua.edu.cn>
Cc: jgg@ziepe.ca, leon@kernel.org, linux-rdma@vger.kernel.org,
security@kernel.org
Subject: Re: [PATCH 1/1] RDMA/uverbs: Validate wqe_size before using it in ib_uverbs_post_send
Date: Thu, 22 Jan 2026 18:10:23 +0100 [thread overview]
Message-ID: <2026012211-curable-issue-0342@gregkh> (raw)
In-Reply-To: <20260122142900.2356276-2-liuy22@mails.tsinghua.edu.cn>
On Thu, Jan 22, 2026 at 10:29:00PM +0800, Yi Liu wrote:
> ib_uverbs_post_send() uses cmd.wqe_size from userspace without any
> validation before passing it to kmalloc() and using the allocated
> buffer as struct ib_uverbs_send_wr.
>
> If a user provides a small wqe_size value (e.g., 1), kmalloc() will
> succeed, but subsequent accesses to user_wr->opcode, user_wr->num_sge,
> and other fields will read beyond the allocated buffer, resulting in
> an out-of-bounds read from kernel heap memory. This could potentially
> leak sensitive kernel information to userspace.
>
> Additionally, providing an excessively large wqe_size can trigger a
> WARNING in the memory allocation path, as reported by syzkaller.
>
> This is inconsistent with ib_uverbs_unmarshall_recv() which properly
> validates that wqe_size >= sizeof(struct ib_uverbs_recv_wr) before
> proceeding.
>
> Add the same validation for ib_uverbs_post_send() to ensure wqe_size
> is at least sizeof(struct ib_uverbs_send_wr).
>
> Fixes: 67cdb40ca444 ("[IB] uverbs: Implement more commands")
> Signed-off-by: Yi Liu <liuy22@mails.tsinghua.edu.cn>
> ---
> drivers/infiniband/core/uverbs_cmd.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c
> index ce16404cd..a80b95948 100644
> --- a/drivers/infiniband/core/uverbs_cmd.c
> +++ b/drivers/infiniband/core/uverbs_cmd.c
> @@ -2049,6 +2049,9 @@ static int ib_uverbs_post_send(struct uverbs_attr_bundle *attrs)
> if (ret)
> return ret;
>
> + if (cmd.wqe_size < sizeof(struct ib_uverbs_send_wr))
> + return -EINVAL;
> +
> user_wr = kmalloc(cmd.wqe_size, GFP_KERNEL);
> if (!user_wr)
> return -ENOMEM;
> --
> 2.34.1
>
>
Hi,
This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him
a patch that has triggered this response. He used to manually respond
to these common problems, but in order to save his sanity (he kept
writing the same thing over and over, yet to different people), I was
created. Hopefully you will not take offence and will fix the problem
in your patch and resubmit it so that it can be accepted into the Linux
kernel tree.
You are receiving this message because of the following common error(s)
as indicated below:
- You have marked a patch with a "Fixes:" tag for a commit that is in an
older released kernel, yet you do not have a cc: stable line in the
signed-off-by area at all, which means that the patch will not be
applied to any older kernel releases. To properly fix this, please
follow the documented rules in the
Documentation/process/stable-kernel-rules.rst file for how to resolve
this.
If you wish to discuss this problem further, or you have questions about
how to resolve this issue, please feel free to respond to this email and
Greg will reply once he has dug out from the pending patches received
from other developers.
thanks,
greg k-h's patch email bot
next prev parent reply other threads:[~2026-01-22 17:10 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-22 14:28 [PATCH 0/1] RDMA/uverbs: Fix missing wqe_size validation in ib_uverbs_post_send Yi Liu
2026-01-22 14:29 ` [PATCH 1/1] RDMA/uverbs: Validate wqe_size before using it " Yi Liu
2026-01-22 17:10 ` Greg KH [this message]
2026-01-26 13:07 ` Leon Romanovsky
2026-01-26 13:07 ` Leon Romanovsky
2026-01-22 17:10 ` [PATCH 0/1] RDMA/uverbs: Fix missing wqe_size validation " Greg KH
-- strict thread matches above, loose matches on Subject: below --
2026-01-23 1:42 [PATCH v2 " Yi Liu
2026-01-23 1:42 ` [PATCH 1/1] RDMA/uverbs: Validate wqe_size before using it " Yi Liu
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=2026012211-curable-issue-0342@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=jgg@ziepe.ca \
--cc=leon@kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=liuy22@mails.tsinghua.edu.cn \
--cc=security@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