From: Jason Gunthorpe <jgg@mellanox.com>
To: Leon Romanovsky <leon@kernel.org>
Cc: Doug Ledford <dledford@redhat.com>,
Leon Romanovsky <leonro@mellanox.com>,
RDMA mailing list <linux-rdma@vger.kernel.org>,
Daniel Jurgens <danielj@mellanox.com>,
Danit Goldberg <danitg@mellanox.com>,
Yishai Hadas <yishaih@mellanox.com>
Subject: Re: [PATCH 2/2] IB/mlx5: Free mpi in mp_slave mode
Date: Mon, 16 Sep 2019 17:23:59 +0000 [thread overview]
Message-ID: <20190916172353.GD2585@mellanox.com> (raw)
In-Reply-To: <20190916064818.19823-3-leon@kernel.org>
On Mon, Sep 16, 2019 at 09:48:18AM +0300, Leon Romanovsky wrote:
> From: Danit Goldberg <danitg@mellanox.com>
>
> ib_add_slave_port() allocates a multiport struct but never frees it.
> Don't leak memory, free the allocated mpi struct during driver unload.
>
> Fixes: 32f69e4be269 ("{net, IB}/mlx5: Manage port association for multiport RoCE")
> Signed-off-by: Danit Goldberg <danitg@mellanox.com>
> drivers/infiniband/hw/mlx5/main.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
> index 0569bcab02d4..14807ea8dc3f 100644
> +++ b/drivers/infiniband/hw/mlx5/main.c
> @@ -6959,6 +6959,7 @@ static void mlx5_ib_remove(struct mlx5_core_dev *mdev, void *context)
> mlx5_ib_unbind_slave_port(mpi->ibdev, mpi);
> list_del(&mpi->list);
> mutex_unlock(&mlx5_ib_multiport_mutex);
> + kfree(mpi);
> return;
> }
Personally I think the way this code was written to try to share the
struct mlx5_interface between two completely different usages, with
totally different opaque structs is really obtuse.
Two interfaces callback blocks for the two parallel uses would have
been cleaner and might have made this missing kfree clearer.
Jason
next prev parent reply other threads:[~2019-09-16 17:24 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-16 6:48 [PATCH 0/2] Two fixes for this merge window Leon Romanovsky
2019-09-16 6:48 ` [PATCH 1/2] IB/mlx5: Free page from the beginning of the allocation Leon Romanovsky
2019-09-16 6:48 ` [PATCH 2/2] IB/mlx5: Free mpi in mp_slave mode Leon Romanovsky
2019-09-16 17:23 ` Jason Gunthorpe [this message]
2019-09-16 17:22 ` [PATCH 0/2] Two fixes for this merge window 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=20190916172353.GD2585@mellanox.com \
--to=jgg@mellanox.com \
--cc=danielj@mellanox.com \
--cc=danitg@mellanox.com \
--cc=dledford@redhat.com \
--cc=leon@kernel.org \
--cc=leonro@mellanox.com \
--cc=linux-rdma@vger.kernel.org \
--cc=yishaih@mellanox.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.