Thread View: linux.kernel.netdev
5 messages
5 total messages
Started by Wentao Liang
Wed, 04 Nov 2026 02:28
[PATCH] net/rds: drop the device reference for ODP memory regions
Author: Wentao Liang
Date: Wed, 04 Nov 2026 02:28
Date: Wed, 04 Nov 2026 02:28
43 lines
9502 bytes
9502 bytes
rds_ib_get_mr() takes a reference on the rds_ib_device with
rds_ib_get_device(). The FRMR path stores it in ibmr->device and
rds_ib_free_mr() drops it when the MR is freed.
The ODP path allocates the ibmr with kzalloc_obj() and returns it
without recording the device. rds_ib_odp_mr_worker() only deregisters
the MR and frees the ibmr, so the reference taken for every ODP MR is
never dropped and the rds_ib_device can no longer be released.
Store the reference in ibmr->device and drop it in the worker after
the MR has been deregistered, which also keeps the device and its PD
alive for as long as the MR exists.
Fixes: 2eafa1746f17 ("net/rds: Handle ODP mr registration/unregistration")
Cc: stable@vger.kernel.org
Assisted-by: DeepSeek-V4.1-Flash and OpenAI Codex
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
net/rds/ib_rdma.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/rds/ib_rdma.c b/net/rds/ib_rdma.c
index db7e92e7bd29..8cd8295f66a3 100644
--- a/net/rds/ib_rdma.c
+++ b/net/rds/ib_rdma.c
@@ -591,6 +591,7 @@ void *rds_ib_get_mr(struct scatterlist *sg, unsigned long nents,
}
ibmr->u.mr = ib_mr;
ibmr->odp = 1;
+ ibmr->device = rds_ibdev;
sge.addr = virt_addr;
sge.length = length;
@@ -697,5 +698,6 @@ static void rds_ib_odp_mr_worker(struct work_struct *work)
ibmr = container_of(work, struct rds_ib_mr, work.work);
ib_dereg_mr(ibmr->u.mr);
+ rds_ib_dev_put(ibmr->device);
kfree(ibmr);
}
--
2.34.1
Re: [PATCH] net/rds: drop the device reference for ODP memory regions
Author: netdev-bot+sinfo
Date: Wed, 04 Nov 2026 02:33
Date: Wed, 04 Nov 2026 02:33
22 lines
8692 bytes
8692 bytes
Hi! This is an automated message. This series looks like a fix, but its commit messages seem to be missing some information: - How the issue was discovered, e.g. hit in production, hit during development, syzbot report, manual code inspection, LLM or static analysis tool scan. - Whether the issue was actually triggered, or is only theoretical (e.g. found by code inspection). If it was triggered please include the symptoms, like the stack trace or error messages. Please do not repost the series just to address the above. Instead, reply to this email with the missing information, so that reviewers can take it into account. If the series needs another revision for other reasons, please include the information in the commit messages then. The evaluation is done by an LLM so it may be wrong, if you think that is the case please reply and explain.
Re: [PATCH] net/rds: drop the device reference for ODP memory regions
Author: Krzysztof Kozlowski
Date: Wed, 04 Nov 2026 07:11
Date: Wed, 04 Nov 2026 07:11
62 lines
10271 bytes
10271 bytes
On Wed, 04 Nov 2026 02:28:10 +0000, Wentao Liang wrote:
> rds_ib_get_mr() takes a reference on the rds_ib_device with
> rds_ib_get_device(). The FRMR path stores it in ibmr->device and
> rds_ib_free_mr() drops it when the MR is freed.
>
> The ODP path allocates the ibmr with kzalloc_obj() and returns it
> without recording the device. rds_ib_odp_mr_worker() only deregisters
> the MR and frees the ibmr, so the reference taken for every ODP MR is
> never dropped and the rds_ib_device can no longer be released.
>
> Store the reference in ibmr->device and drop it in the worker after
> the MR has been deregistered, which also keeps the device and its PD
> alive for as long as the MR exists.
>
> Fixes: 2eafa1746f17 ("net/rds: Handle ODP mr registration/unregistration")
> Cc: stable@vger.kernel.org
> Assisted-by: DeepSeek-V4.1-Flash and OpenAI Codex
> Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
> ---
> net/rds/ib_rdma.c | 2 ++
> 1 file changed, 2 insertions(+)
>
Multiple things here:
1. Your team ignored completely previous feedback. Multiple times.
2. You use multiple identities with this email address, thus I doubt that we
speak with an actual person.
3. Your bot does not even bother running checkpatch, right?
4. Nothing of this was reproduced nor tested.
5. Finally, the same feedback:
You sent multiple independent patches, to multiple independent
subsystems. The amount of these patches clearly suggest this was
AI generated and most likely not tested.
More importantly, you sent all this work without properly organizing
relevant patches into patchsets. This makes reviewing difficult
and might cause multiple reviewers to address the same issue.
Replying to the entire set is impossible and requires handling each
patch independently, instead of applying or discarding the set.
Maintainers also won't see the bigger picture of your work. Quite
worrying.
This is on the verge of hostile patch: bomb us with so many
contributions, we won't be able to handle them in efficient manner,
like responding ONCE to ask you to slow down. Considering all this
is untested and LLM generated, I have even more doubts whether this
should be considered for review.
Please read kernel documentation BEFORE posting more work. It will
explain you how to identify subsystems, how to organize your work per
subsystem (so a patchset grouping multiple patches with a short cover
letter), how to document the issue discovery method and what was
or was not tested.
Best regards,
Krzysztof
Re: [PATCH] net/rds: drop the device reference for ODP memory regions
Author: Allison Henderson
Date: Wed, 04 Nov 2026 22:15
Date: Wed, 04 Nov 2026 22:15
65 lines
9880 bytes
9880 bytes
On Wed, 2026-11-04 at 02:28 +0000, Wentao Liang wrote:
> rds_ib_get_mr() takes a reference on the rds_ib_device with
> rds_ib_get_device(). The FRMR path stores it in ibmr->device and
> rds_ib_free_mr() drops it when the MR is freed.
>
> The ODP path allocates the ibmr with kzalloc_obj() and returns it
> without recording the device. rds_ib_odp_mr_worker() only deregisters
> the MR and frees the ibmr, so the reference taken for every ODP MR is
> never dropped and the rds_ib_device can no longer be released.
>
> Store the reference in ibmr->device and drop it in the worker after
> the MR has been deregistered, which also keeps the device and its PD
> alive for as long as the MR exists.
>
> Fixes: 2eafa1746f17 ("net/rds: Handle ODP mr registration/unregistration")
> Cc: stable@vger.kernel.org
> Assisted-by: DeepSeek-V4.1-Flash and OpenAI Codex
> Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
Hi Wentao,
Thanks for the patch. The fix itself looks reasonable, but few things to update: since
this is a bug fix, it should should target net with [PATCH net v2]. The commit message
should mention how this was found, and whether it was tested. Reproducing this needs an
ODP-capable device, so if it was only build-tested, please say so. It looks like there's
a few check patch nits to work through as well:
https://patchwork.kernel.org/project/netdevbpf/patch/20261104022810.1484182-1-vulab@iscas.ac.cn/
Other than that it looks straight forward to me.
Thanks,
Allison
> ---
> net/rds/ib_rdma.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/net/rds/ib_rdma.c b/net/rds/ib_rdma.c
> index db7e92e7bd29..8cd8295f66a3 100644
> --- a/net/rds/ib_rdma.c
> +++ b/net/rds/ib_rdma.c
> @@ -591,6 +591,7 @@ void *rds_ib_get_mr(struct scatterlist *sg, unsigned long nents,
> }
> ibmr->u.mr = ib_mr;
> ibmr->odp = 1;
> + ibmr->device = rds_ibdev;
>
> sge.addr = virt_addr;
> sge.length = length;
> @@ -697,5 +698,6 @@ static void rds_ib_odp_mr_worker(struct work_struct *work)
>
> ibmr = container_of(work, struct rds_ib_mr, work.work);
> ib_dereg_mr(ibmr->u.mr);
> + rds_ib_dev_put(ibmr->device);
> kfree(ibmr);
> }
Re: [PATCH] net/rds: drop the device reference for ODP memory regions
Author: netdev-bot+sashiko
Date: Sun, 08 Nov 2026 03:04
Date: Sun, 08 Nov 2026 03:04
103 lines
11374 bytes
11374 bytes
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.
Critical: 0 ยท High: 1 ยท Medium: 0 ยท Low: 0
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [High] The patch adds rds_ib_dev_put(ibmr->device) to
rds_ib_odp_mr_worker() (net/rds/ib_rdma.c:701).
--
net/rds: drop the device reference for ODP memory regions
The ODP path in rds_ib_get_mr() takes a reference on the rds_ib_device
but never stores or drops it, so the reference leaks. This patch stores
the device in ibmr->device. It drops the reference in
rds_ib_odp_mr_worker() after the MR has been deregistered.
> diff --git a/net/rds/ib_rdma.c b/net/rds/ib_rdma.c
> index db7e92e7bd29f..8cd8295f66a39 100644
> --- a/net/rds/ib_rdma.c
> +++ b/net/rds/ib_rdma.c
[ ... ]
> @@ -697,5 +698,6 @@ static void rds_ib_odp_mr_worker(struct work_struct *work)
>
> ibmr = container_of(work, struct rds_ib_mr, work.work);
> ib_dereg_mr(ibmr->u.mr);
> + rds_ib_dev_put(ibmr->device);
[Severity: High]
Can this put now race with unloading the rds_rdma module?
After this change, the ODP worker on rds_ib_mr_wq can drop the last
rds_ib_device reference. The final put queues module code on rds_wq,
and rds_wq belongs to rds core:
net/rds/ib.c:rds_ib_dev_put() {
...
if (refcount_dec_and_test(&rds_ibdev->refcount))
queue_work(rds_wq, &rds_ibdev->free_work);
}
The exit path flushes rds_wq only once, in rds_ib_unregister_client().
That happens before rds_ib_mr_wq is drained:
rds_ib_exit()
rds_ib_unregister_client()
ib_unregister_client(&rds_ib_client);
/* wait for rds_ib_dev_free() to complete */
flush_workqueue(rds_wq);
rds_ib_destroy_nodev_conns();
...
rds_ib_mr_exit()
destroy_workqueue(rds_ib_mr_wq);
An ODP worker can still be pending when that flush runs. For example,
closing an RDS socket that owns an ODP MR goes through:
rds_release()
rds_rdma_drop_keys()
__rds_put_mr_final()
rds_destroy_mr()
rds_ib_free_mr()
queue_delayed_work(rds_ib_mr_wq, &ibmr->work, 0);
...
rds_trans_put(rs->rs_transport);
Once rds_trans_put() drops the module reference, rmmod rds_rdma can go
ahead while that worker is still queued.
ODP workers can also be queued after the rds_wq flush. Messages on
nodev connections that carry op_odp_mr go through
rds_ib_destroy_nodev_conns() -> rds_conn_destroy() -> rds_rdma_free_op().
The worker might run on its own, or be drained by destroy_workqueue() in
rds_ib_mr_exit(). Either way, if it drops the final reference,
rds_ib_dev_free() is queued on rds_wq and nothing waits for it.
Could that work then run after the rds_rdma module text has been freed,
and touch the pools and PD after the module is gone?
Before this patch the ODP reference was leaked, so this ordering could
not happen. The comment above rds_ib_mr_exit() says the pool flushing
work queue should be idle by then, and that no longer seems to hold.
Would it make sense to flush rds_ib_mr_wq before the
flush_workqueue(rds_wq) in rds_ib_unregister_client()? Another option
would be to flush rds_wq again after rds_ib_mr_exit().
> kfree(ibmr);
> }
--
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261104022810.1484182-1-vulab%40iscas.ac.cn
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads