* [PATCH rdma-rc] RDMA/qedr: Destroy XArray during release of resources
@ 2022-10-27 12:01 Leon Romanovsky
2022-10-27 12:05 ` Jason Gunthorpe
0 siblings, 1 reply; 3+ messages in thread
From: Leon Romanovsky @ 2022-10-27 12:01 UTC (permalink / raw)
To: Jason Gunthorpe; +Cc: Leon Romanovsky, Ariel Elior, linux-rdma, Michal Kalderon
From: Leon Romanovsky <leonro@nvidia.com>
Destroy XArray while releasing qedr resources.
Fixes: b6014f9e5f39 ("qedr: Convert qpidr to XArray")
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
---
I'm sending it to -rc just because of dependency on
https://lore.kernel.org/linux-rdma/166687129991.306571.17052575958640789335.b4-ty@kernel.org/T/#m0e945baa7f2c87ede9f1711c992889602ede7875
qps is empty and nothing is really leaked here.
---
drivers/infiniband/hw/qedr/main.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/infiniband/hw/qedr/main.c b/drivers/infiniband/hw/qedr/main.c
index ba0c3e4c07d8..9f53afed2bd0 100644
--- a/drivers/infiniband/hw/qedr/main.c
+++ b/drivers/infiniband/hw/qedr/main.c
@@ -308,8 +308,10 @@ static void qedr_free_resources(struct qedr_dev *dev)
{
int i;
- if (IS_IWARP(dev))
+ if (IS_IWARP(dev)) {
destroy_workqueue(dev->iwarp_wq);
+ xa_destroy(&dev->qps);
+ }
for (i = 0; i < dev->num_cnq; i++) {
qedr_free_mem_sb(dev, &dev->sb_array[i], dev->sb_start + i);
@@ -407,8 +409,10 @@ static int qedr_alloc_resources(struct qedr_dev *dev)
err2:
kfree(dev->sb_array);
err_destroy_wq:
- if (IS_IWARP(dev))
+ if (IS_IWARP(dev)) {
destroy_workqueue(dev->iwarp_wq);
+ xa_destroy(&dev->qps);
+ }
err1:
kfree(dev->sgid_tbl);
return rc;
--
2.37.3
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH rdma-rc] RDMA/qedr: Destroy XArray during release of resources
2022-10-27 12:01 [PATCH rdma-rc] RDMA/qedr: Destroy XArray during release of resources Leon Romanovsky
@ 2022-10-27 12:05 ` Jason Gunthorpe
2022-10-27 12:29 ` Leon Romanovsky
0 siblings, 1 reply; 3+ messages in thread
From: Jason Gunthorpe @ 2022-10-27 12:05 UTC (permalink / raw)
To: Leon Romanovsky; +Cc: Leon Romanovsky, Ariel Elior, linux-rdma, Michal Kalderon
On Thu, Oct 27, 2022 at 03:01:16PM +0300, Leon Romanovsky wrote:
> From: Leon Romanovsky <leonro@nvidia.com>
>
> Destroy XArray while releasing qedr resources.
>
> Fixes: b6014f9e5f39 ("qedr: Convert qpidr to XArray")
> Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
> ---
> I'm sending it to -rc just because of dependency on
> https://lore.kernel.org/linux-rdma/166687129991.306571.17052575958640789335.b4-ty@kernel.org/T/#m0e945baa7f2c87ede9f1711c992889602ede7875
> qps is empty and nothing is really leaked here.
if qps is known to be empty then this should be WARN_ON(!xa_empty()) -
destroying an xarray that holds allocated memory is never correct - it
will leak the elements
Also, this isn't "for-rc", so it should go to -next. With a dependency
like this the patch waits until linus merges the rc branch and then
-next merges linus's rcX tag to resolve the conflict.
Jason
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH rdma-rc] RDMA/qedr: Destroy XArray during release of resources
2022-10-27 12:05 ` Jason Gunthorpe
@ 2022-10-27 12:29 ` Leon Romanovsky
0 siblings, 0 replies; 3+ messages in thread
From: Leon Romanovsky @ 2022-10-27 12:29 UTC (permalink / raw)
To: Jason Gunthorpe; +Cc: Ariel Elior, linux-rdma, Michal Kalderon
On Thu, Oct 27, 2022 at 09:05:08AM -0300, Jason Gunthorpe wrote:
> On Thu, Oct 27, 2022 at 03:01:16PM +0300, Leon Romanovsky wrote:
> > From: Leon Romanovsky <leonro@nvidia.com>
> >
> > Destroy XArray while releasing qedr resources.
> >
> > Fixes: b6014f9e5f39 ("qedr: Convert qpidr to XArray")
> > Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
> > ---
> > I'm sending it to -rc just because of dependency on
> > https://lore.kernel.org/linux-rdma/166687129991.306571.17052575958640789335.b4-ty@kernel.org/T/#m0e945baa7f2c87ede9f1711c992889602ede7875
> > qps is empty and nothing is really leaked here.
>
> if qps is known to be empty then this should be WARN_ON(!xa_empty()) -
> destroying an xarray that holds allocated memory is never correct - it
> will leak the elements
>
> Also, this isn't "for-rc", so it should go to -next. With a dependency
> like this the patch waits until linus merges the rc branch and then
> -next merges linus's rcX tag to resolve the conflict.
Let's drop this patch. QPS is empty.
Thanks
>
> Jason
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-10-27 12:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-27 12:01 [PATCH rdma-rc] RDMA/qedr: Destroy XArray during release of resources Leon Romanovsky
2022-10-27 12:05 ` Jason Gunthorpe
2022-10-27 12:29 ` Leon Romanovsky
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox