Re: [PATCH 4.19 03/79] RDMA/restrack: Release task struct which was hold by CM_ID object

Pavel Machek
2019-09-21T20:22:15Z

[-- Attachment #1: Type: text/plain, Size: 1334 bytes --]

Hi!

> commit ed7a01fd3fd77f40b4ef2562b966a5decd8928d2 upstream.
>
> Tracking CM_ID resource is performed in two stages: creation of cm_id
> and connecting it to the cma_dev. It is needed because rdma-cm protocol
> exports two separate user-visible calls rdma_create_id and
> rdma_accept.
...

Mainline says this needs additional fix, fe9bc1644918aa1d, see below.

> --- a/drivers/infiniband/core/restrack.c
> +++ b/drivers/infiniband/core/restrack.c
> @@ -209,7 +209,7 @@ void rdma_restrack_del(struct rdma_restr
> struct ib_device *dev;
>
> if (!res->valid)
> - return;
> + goto out;
>
> dev = res_to_dev(res);
> if (!dev)
# return;

This test does return, does it need to go through 'goto out', too? (I
see it should not happen, but...)

> @@ -222,8 +222,10 @@ void rdma_restrack_del(struct rdma_restr
> down_write(&dev->res.rwsem);
> hash_del(&res->node);
> res->valid = false;
> + up_write(&dev->res.rwsem);
> +
> +out:
> if (res->task)
> put_task_struct(res->task);
> - up_write(&dev->res.rwsem);
> }

Mainline says res->task = NULL is needed there, see fe9bc1644918aa1d.

Best regards,
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]