From 87c7f48d33da1aca59024817519a854a535801cf Mon Sep 17 00:00:00 2001 From: yanshuai01 Date: Wed, 16 Oct 2024 15:11:19 +0800 Subject: [PATCH] Fix memory leak in grant_process_token_dacl_permissions --- ...in-grant_process_token_dacl_permissi.patch | 35 +++++++++++++++++++ pciutils.spec | 6 +++- 2 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 0002-Fix-memory-leak-in-grant_process_token_dacl_permissi.patch diff --git a/0002-Fix-memory-leak-in-grant_process_token_dacl_permissi.patch b/0002-Fix-memory-leak-in-grant_process_token_dacl_permissi.patch new file mode 100644 index 0000000..c00f35f --- /dev/null +++ b/0002-Fix-memory-leak-in-grant_process_token_dacl_permissi.patch @@ -0,0 +1,35 @@ +From 6e50724345522dce3f74f076dc2a0662956ba933 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Pali=20Roh=C3=A1r?= +Date: Wed, 7 Jun 2023 19:53:32 +0200 +Subject: [PATCH] libpci: i386-io-windows.h: Fix memory leak in + grant_process_token_dacl_permissions() + +When SetEntriesInAcl() call success then new_dacl allocated by this +function has to be released by LocalFree() call. + +--- + lib/i386-io-windows.h | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/lib/i386-io-windows.h b/lib/i386-io-windows.h +index ac2a55d..caba1bc 100644 +--- a/lib/i386-io-windows.h ++++ b/lib/i386-io-windows.h +@@ -593,12 +593,14 @@ grant_process_token_dacl_permissions(HANDLE process, DWORD permissions, HANDLE * + + if (MySetSecurityInfo(*token, SE_KERNEL_OBJECT, DACL_SECURITY_INFORMATION, NULL, NULL, new_dacl, NULL) != ERROR_SUCCESS) + { ++ LocalFree(new_dacl); + LocalFree(*security_descriptor); + LocalFree(owner); + CloseHandle(*token); + return FALSE; + } + ++ LocalFree(new_dacl); + LocalFree(owner); + return TRUE; + } +-- +2.27.0 + diff --git a/pciutils.spec b/pciutils.spec index 42340fe..cbc1f56 100644 --- a/pciutils.spec +++ b/pciutils.spec @@ -1,6 +1,6 @@ Name: pciutils Version: 3.8.0 -Release: 1 +Release: 2 Summary: PCI bus related utilities License: GPLv2+ URL: http://atrey.karlin.mff.cuni.cz/~mj/pciutils.shtml @@ -10,6 +10,7 @@ Source0: https://mirrors.edge.kernel.org/pub/software/utils/pciutils/%{na Patch0: 0000-pciutils-2.2.1-idpath.patch # patch1 is from fedora, rhbz#195327 Patch1: 0001-pciutils-dir-d.patch +Patch2: 0002-Fix-memory-leak-in-grant_process_token_dacl_permissi.patch ExclusiveOS: Linux BuildRequires: gcc sed kmod-devel pkgconfig zlib-devel @@ -105,6 +106,9 @@ rm -rf $RPM_BUILD_ROOT/usr/share/hwdata/pci.ids* rm -rf $RPM_BUILD_ROOT %changelog +* Wed Oct 16 2024 yanshuai - 3.8.0-2 +- libpci: i386-io-windows.h: Fix memory leak in grant_process_token_dacl_permissions() + * Fri Oct 28 2022 liusirui - 3.8.0-1 - update to v3.8.0 -- Gitee