]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commit
RDMA/rtrs-clt: Fix memory leak of not-freed sess->stats and stats->pcpu_stats
authorGioh Kim <gi-oh.kim@cloud.ionos.com>
Fri, 28 May 2021 11:30:18 +0000 (13:30 +0200)
committerStefan Bader <stefan.bader@canonical.com>
Fri, 13 Aug 2021 07:30:44 +0000 (09:30 +0200)
commit5bbe361cbd605447ec15275d5e5abee48aef36c4
treef884a9eceebc642bae67ae84cf0f528edc568bf5
parent8d0e68d2dc329078ba1b0346e07cfe41f86a8805
RDMA/rtrs-clt: Fix memory leak of not-freed sess->stats and stats->pcpu_stats

BugLink: https://bugs.launchpad.net/bugs/1938340
[ Upstream commit 7ecd7e290bee0ab9cf75b79a367a4cc113cf8292 ]

sess->stats and sess->stats->pcpu_stats objects are freed
when sysfs entry is removed. If something wrong happens and
session is closed before sysfs entry is created,
sess->stats and sess->stats->pcpu_stats objects are not freed.

This patch adds freeing of them at three places:
1. When client uses wrong address and session creation fails.
2. When client fails to create a sysfs entry.
3. When client adds wrong address via sysfs add_path.

Fixes: 215378b838df0 ("RDMA/rtrs: client: sysfs interface functions")
Link: https://lore.kernel.org/r/20210528113018.52290-21-jinpu.wang@ionos.com
Signed-off-by: Gioh Kim <gi-oh.kim@ionos.com>
Signed-off-by: Jack Wang <jinpu.wang@ionos.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
drivers/infiniband/ulp/rtrs/rtrs-clt.c