Linux-Modules Archive mirror
 help / color / mirror / Atom feed
* [PATCH] modprobe: rmmod_do_module: Free kmod list of holders
@ 2023-04-18  8:52 Nicolas Schier
  2023-04-18 22:52 ` Lucas De Marchi
  0 siblings, 1 reply; 2+ messages in thread
From: Nicolas Schier @ 2023-04-18  8:52 UTC (permalink / raw
  To: linux-modules, Lucas De Marchi; +Cc: Nicolas Schier, Nicolas Schier

Add a missing kmod_module_unref_list() to fix a memory leak.

Fixes: 42b32d30c38e ("modprobe: Fix holders removal")
Signed-off-by: Nicolas Schier <n.schier@avm.de>
---
Resend as a separate patch as suggested in https://lore.kernel.org/linux-modules/20230412192151.jbbcltmcwwamhlm6@ldmartin-desk2.lan/
---
 tools/modprobe.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/modprobe.c b/tools/modprobe.c
index 3b7897c..e891028 100644
--- a/tools/modprobe.c
+++ b/tools/modprobe.c
@@ -455,6 +455,7 @@ static int rmmod_do_module(struct kmod_module *mod, int flags)
 		struct kmod_list *holders = kmod_module_get_holders(mod);
 
 		err = rmmod_do_modlist(holders, true);
+		kmod_module_unref_list(holders);
 		if (err < 0)
 			goto error;
 	}

---
base-commit: 3d1bd339ab942ea47e60f053f4b11b0c47ff082b
change-id: 20230418-add-missing-kmod_module_unref_list-e7c4dd5b6625

Best regards,
-- 
Nicolas Schier

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

end of thread, other threads:[~2023-04-18 22:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-18  8:52 [PATCH] modprobe: rmmod_do_module: Free kmod list of holders Nicolas Schier
2023-04-18 22:52 ` Lucas De Marchi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).