All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] semodule: Don't forget to munmap() data
@ 2021-11-23 16:38 Petr Lautrbach
  2021-11-23 17:42 ` James Carter
  0 siblings, 1 reply; 3+ messages in thread
From: Petr Lautrbach @ 2021-11-23 16:38 UTC (permalink / raw)
  To: selinux; +Cc: Petr Lautrbach, Ondrej Mosnacek

semanage_module_extract() mmap()'s the module raw data but it leaves on
the caller to munmap() them.

Reported-by: Ondrej Mosnacek <omosnace@redhat.com>
Signed-off-by: Petr Lautrbach <plautrba@redhat.com>
---
 policycoreutils/semodule/semodule.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/policycoreutils/semodule/semodule.c b/policycoreutils/semodule/semodule.c
index 57f005ce2c62..94a9d131bb79 100644
--- a/policycoreutils/semodule/semodule.c
+++ b/policycoreutils/semodule/semodule.c
@@ -394,6 +394,9 @@ static char *hash_module_data(const char *module_name, const int prio) {
 	sha256_buf[i * 2] = 0;
 
 cleanup_extract:
+	if (data_len > 0) {
+		munmap(data, data_len);
+	}
 	semanage_module_info_destroy(sh, extract_info);
 	free(extract_info);
 	semanage_module_key_destroy(sh, modkey);
-- 
2.33.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-11-29 17:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-23 16:38 [PATCH] semodule: Don't forget to munmap() data Petr Lautrbach
2021-11-23 17:42 ` James Carter
2021-11-29 17:53   ` Petr Lautrbach

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.