mdadm/0097-super-intel.c-fix-memleak-in-find_disk_attached_hba.patch
Xiao Ni adfbb8ebd5 Update to latest upstream and fix mdcheck service bug
If mdcheck_start service can finish check action, it doesn't need to start mdcheck_continue
service. So in rhel only patch mdcheck.patch, we stop mdcheck_continue timer.

And there is a history problem. It needed KillMode=none before, so it removed
the upstream patch 52c67fcdd. Now this problem has been fixed, so we can do the
backport more easilly now. We don't need to remove the upstream patch here again.

Resolves: rhbz#2116418, rhbz#2150862, rhbz#2159584

Signed-off-by: Xiao Ni <xni@redhat.com>
2023-05-16 16:08:25 +08:00

40 lines
1.1 KiB
Diff

From 5d2434d18b6bc71bd16678b1a6d1cc3a92f1d415 Mon Sep 17 00:00:00 2001
From: Wu Guanghao <wuguanghao3@huawei.com>
Date: Sat, 4 Mar 2023 00:21:34 +0800
Subject: [PATCH 097/125] super-intel.c: fix memleak in
find_disk_attached_hba()
If disk_path = diskfd_to_devpath(), we need free(disk_path) before
return, otherwise there will be a memory leak
Signed-off-by: Wu Guanghao <wuguanghao3@huawei.com>
Reviewed-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
Acked-by: Coly Li <colyli@suse.de>
Signed-off-by: Jes Sorensen <jes@trained-monkey.org>
---
super-intel.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/super-intel.c b/super-intel.c
index 4a3da847..e155a8ae 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -713,12 +713,12 @@ static struct sys_dev* find_disk_attached_hba(int fd, const char *devname)
for (elem = list; elem; elem = elem->next)
if (path_attached_to_hba(disk_path, elem->path))
- return elem;
+ break;
if (disk_path != devname)
free(disk_path);
- return NULL;
+ return elem;
}
static int find_intel_hba_capability(int fd, struct intel_super *super,
--
2.38.1