Patch "riscv: Fix module loading free order" has been added to the 6.7-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

    riscv: Fix module loading free order

to the 6.7-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:
     riscv-fix-module-loading-free-order.patch
and it can be found in the queue-6.7 subdirectory.

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



commit efa49097aa1282b80dc6426c84fcb18110590ce6
Author: Charlie Jenkins <charlie@xxxxxxxxxxxx>
Date:   Thu Jan 4 11:42:47 2024 -0800

    riscv: Fix module loading free order
    
    [ Upstream commit 78996eee79ebdfe8b6f0e54cb6dcc792d5129291 ]
    
    Reverse order of kfree calls to resolve use-after-free error.
    
    Signed-off-by: Charlie Jenkins <charlie@xxxxxxxxxxxx>
    Fixes: d8792a5734b0 ("riscv: Safely remove entries from relocation list")
    Reported-by: kernel test robot <lkp@xxxxxxxxx>
    Reported-by: Dan Carpenter <error27@xxxxxxxxx>
    Closes: https://lore.kernel.org/r/202312132019.iYGTwW0L-lkp@xxxxxxxxx/
    Reported-by: kernel test robot <lkp@xxxxxxxxx>
    Reported-by: Julia Lawall <julia.lawall@xxxxxxxx>
    Closes: https://lore.kernel.org/r/202312120044.wTI1Uyaa-lkp@xxxxxxxxx/
    Reviewed-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20240104-module_loading_fix-v3-1-a71f8de6ce0f@xxxxxxxxxxxx
    Signed-off-by: Palmer Dabbelt <palmer@xxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/arch/riscv/kernel/module.c b/arch/riscv/kernel/module.c
index 862834bb1d64..5cf3a693482d 100644
--- a/arch/riscv/kernel/module.c
+++ b/arch/riscv/kernel/module.c
@@ -723,8 +723,8 @@ static int add_relocation_to_accumulate(struct module *me, int type,
 
 			if (!bucket) {
 				kfree(entry);
-				kfree(rel_head);
 				kfree(rel_head->rel_entry);
+				kfree(rel_head);
 				return -ENOMEM;
 			}
 




[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