Linux-Modules Archive mirror
 help / color / mirror / Atom feed
From: Nicolas Schier <n.schier@avm.de>
To: linux-modules@vger.kernel.org,
	Lucas De Marchi <lucas.de.marchi@gmail.com>
Cc: Nicolas Schier <nicolas@fjasle.eu>, Nicolas Schier <n.schier@avm.de>
Subject: [PATCH] modprobe: rmmod_do_module: Free kmod list of holders
Date: Tue, 18 Apr 2023 10:52:38 +0200	[thread overview]
Message-ID: <20230418-add-missing-kmod_module_unref_list-v1-1-ab5b554f15ee@avm.de> (raw)

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

             reply	other threads:[~2023-04-18  8:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-18  8:52 Nicolas Schier [this message]
2023-04-18 22:52 ` [PATCH] modprobe: rmmod_do_module: Free kmod list of holders Lucas De Marchi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230418-add-missing-kmod_module_unref_list-v1-1-ab5b554f15ee@avm.de \
    --to=n.schier@avm.de \
    --cc=linux-modules@vger.kernel.org \
    --cc=lucas.de.marchi@gmail.com \
    --cc=nicolas@fjasle.eu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).