From: Jason Gunthorpe <jgg@ziepe.ca>
To: luoqing <l1138897701@163.com>
Cc: luoqing@kylinos.cn, Leon Romanovsky <leon@kernel.org>,
linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] rdma: infiniband: Added __alloc_cq request value Return value non-zero value determination
Date: Mon, 7 Apr 2025 13:25:59 -0300 [thread overview]
Message-ID: <20250407162559.GA1562048@ziepe.ca> (raw)
In-Reply-To: <20250407093341.3245344-1-l1138897701@163.com>
On Mon, Apr 07, 2025 at 05:33:41PM +0800, luoqing wrote:
> From: luoqing <luoqing@kylinos.cn>
>
> When the kernel allocates memory for completion queue object ib_cq on the specified
> InfiniBand device dev and ensures that the allocated memory is cleared to zero,
> if the ib_cq object is not initialized to 0, a non-null value is still returned,
> and the kernel should exit and give a warning.
> Avoid kernel crash when this memory is initialized.
?? This doesn't make any sense.
> ib_mad_init_device
> -->ib_mad_port_open
> -->__ib_alloc_cq
> -->rdma_zalloc_drv_obj(dev, ib_cq);
rdma_zalloc_drv_obj() must return memory that is validly castable to
the struct ib_cq.
> When ib_cq is zero, the return value of cq is ZERO_SIZE_PTR ((void *)16) and is not non-null
> cq = rdma_zalloc_drv_obj(dev, ib_cq);
It looks to me like the driver returned the wrong size for the ib_cq
in the ops->size_ib_cq. It is not allowed to be 0 if the driver is
supporting cq.
Arguably we should check that the size_* pointers have the requirement
minimum size when registering the driver.
Allocation time is too late.
Jason
next prev parent reply other threads:[~2025-04-07 16:26 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-07 9:33 luoqing
2025-04-07 16:25 ` Jason Gunthorpe [this message]
[not found] ` <7afc834e.5498.1965c20f9f0.Coremail.l1138897701@163.com>
2025-04-22 11:58 ` Leon Romanovsky
[not found] ` <2ac5915f.14aa.196604a64b6.Coremail.l1138897701@163.com>
2025-04-23 7:14 ` Leon Romanovsky
2026-05-26 9:18 luoqing
2026-05-26 12:23 ` Jason Gunthorpe
2026-05-28 6:54 ` luoqing
2026-05-28 13:09 ` Jason Gunthorpe
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=20250407162559.GA1562048@ziepe.ca \
--to=jgg@ziepe.ca \
--cc=l1138897701@163.com \
--cc=leon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=luoqing@kylinos.cn \
/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®