Patch "modpost: fix null pointer dereference" has been added to the 6.6-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    modpost: fix null pointer dereference

to the 6.6-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     modpost-fix-null-pointer-dereference.patch
and it can be found in the queue-6.6 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 9f8d6ac55e1dd2f10563b51a7e23a542fb83aa59
Author: Max Kellermann <max.kellermann@xxxxxxxxx>
Date:   Thu Feb 15 15:13:21 2024 +0100

    modpost: fix null pointer dereference
    
    [ Upstream commit 23dfd914d2bfc4c9938b0084dffd7105de231d98 ]
    
    If the find_fromsym() call fails and returns NULL, the warn() call
    will dereference this NULL pointer and cause the program to crash.
    
    This happened when I tried to build with "test_user_copy" module.
    With this fix, it prints lots of warnings like this:
    
     WARNING: modpost: lib/test_user_copy: section mismatch in reference: (unknown)+0x4 (section: .text.fixup) -> (unknown) (section: .init.text)
    
    masahiroy@xxxxxxxxxx:
     The issue is reproduced with ARCH=arm allnoconfig + CONFIG_MODULES=y +
     CONFIG_RUNTIME_TESTING_MENU=y + CONFIG_TEST_USER_COPY=m
    
    Signed-off-by: Max Kellermann <max.kellermann@xxxxxxxxx>
    Signed-off-by: Masahiro Yamada <masahiroy@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 7d53942445d75..269bd79bcd9ad 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -1098,7 +1098,9 @@ static void default_mismatch_handler(const char *modname, struct elf_info *elf,
 	sec_mismatch_count++;
 
 	warn("%s: section mismatch in reference: %s+0x%x (section: %s) -> %s (section: %s)\n",
-	     modname, fromsym, (unsigned int)(faddr - from->st_value), fromsec, tosym, tosec);
+	     modname, fromsym,
+	     (unsigned int)(faddr - (from ? from->st_value : 0)),
+	     fromsec, tosym, tosec);
 
 	if (mismatch->mismatch == EXTABLE_TO_NON_TEXT) {
 		if (match(tosec, mismatch->bad_tosec))




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux