Skip to contentSkip to conversation

module-fix-lost-error-code-from-codetag_load_module.patch removed from -mm tree

merged mm-hotfixes-stable Andrew Morton 1 participant 1 message Sep 26 Stable branch

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: module: fix lost error code from codetag_load_module()
has been removed from the -mm tree. Its filename was
module-fix-lost-error-code-from-codetag_load_module.patch

This patch was dropped because it was merged into the mm-hotfixes-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Hao Ge <[email protected]>
Subject: module: fix lost error code from codetag_load_module()
Date: Thu, 27 Aug 2026 11:05:03 +0800

If codetag_load_module() fails, err is not set to reflect the failure and load_module() returns 0 after the module has been torn down.

Also, if the module is a livepatch, mod->klp_info allocated by copy_module_elf() leaks on this error path. Free it via a new livepatch_cleanup label.

Fixes 044d2aee6c57 ("alloc_tag: handle module codetag load errors as module load failures")
Cc Aaron Tomlin <[email protected]>
Cc Luis Chamberalin <[email protected]>
Cc Sami Tolvanen <[email protected]>
Cc Suren Baghdasaryan <[email protected]>

---

 kernel/module/main.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
kernel/module/main.c renamed from kernel/module/main.c~module-fix-lost-error-code-from-codetag_load_module +6 -2
@@ -3581,8 +3581,9 @@ static int load_module(struct load_info
 			goto sysfs_cleanup;
 	}
 
-	if (codetag_load_module(mod))
-		goto sysfs_cleanup;
+	err = codetag_load_module(mod);
+	if (err)
+		goto livepatch_cleanup;
 
 	/* Get rid of temporary copy. */
 	free_copy(info, flags);
@@ -3592,6 +3593,9 @@ static int load_module(struct load_info
 
 	return do_init_module(mod);
 
+ livepatch_cleanup:
+	if (is_livepatch_module(mod))
+		free_module_elf(mod);
  sysfs_cleanup:
 	mod_sysfs_teardown(mod);
  coming_cleanup:

_

Patches currently in -mm which might be from [email protected] are

mm-alloc_tag-account-for-reserved-tag-ids-in-the-kernel-tag-check.patch