linux-modules.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] module: print module name on refcount error
@ 2023-06-26 10:32 Jean Delvare
  2023-06-28 10:30 ` Michal Hocko
  2023-06-30 23:05 ` Luis Chamberlain
  0 siblings, 2 replies; 14+ messages in thread
From: Jean Delvare @ 2023-06-26 10:32 UTC (permalink / raw)
  To: Luis Chamberlain; +Cc: Michal Hocko, linux-modules, linux-kernel

If module_put() triggers a refcount error, include the culprit
module name in the warning message, to easy further investigation of
the issue.

Signed-off-by: Jean Delvare <jdelvare@suse.de>
Suggested-by: Michal Hocko <mhocko@suse.com>
Cc: Luis Chamberlain <mcgrof@kernel.org>
---
 kernel/module/main.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--- linux-6.3.orig/kernel/module/main.c
+++ linux-6.3/kernel/module/main.c
@@ -850,7 +850,9 @@ void module_put(struct module *module)
 	if (module) {
 		preempt_disable();
 		ret = atomic_dec_if_positive(&module->refcnt);
-		WARN_ON(ret < 0);	/* Failed to put refcount */
+		WARN(ret < 0,
+		     KERN_WARNING "Failed to put refcount for module %s\n",
+		     module->name);
 		trace_module_put(module, _RET_IP_);
 		preempt_enable();
 	}


-- 
Jean Delvare
SUSE L3 Support

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

end of thread, other threads:[~2023-09-14 19:40 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-26 10:32 [PATCH] module: print module name on refcount error Jean Delvare
2023-06-28 10:30 ` Michal Hocko
2023-07-04 12:43   ` Jean Delvare
2023-07-04 13:05     ` Michal Hocko
2023-07-04 14:35       ` Jean Delvare
2023-06-30 23:05 ` Luis Chamberlain
2023-07-01 15:57   ` Jean Delvare
2023-07-03 10:45     ` Jean Delvare
2023-07-03 13:47   ` Michal Hocko
2023-07-07 18:56     ` Luis Chamberlain
2023-07-10  5:43       ` Michal Hocko
2023-07-26 20:59         ` Luis Chamberlain
2023-08-28 12:18           ` Jean Delvare
2023-09-14 19:39             ` Michal Hocko

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 NNTP newsgroup(s).