Patch "of: overlay: fix null pointer dereferencing in find_dup_cset_node_entry() and find_dup_cset_prop()" has been added to the 5.10-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

    of: overlay: fix null pointer dereferencing in find_dup_cset_node_entry() and find_dup_cset_prop()

to the 5.10-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:
     of-overlay-fix-null-pointer-dereferencing-in-find_du.patch
and it can be found in the queue-5.10 subdirectory.

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



commit 4037e9bd06e550ab5398144afee043975c742ab5
Author: ruanjinjie <ruanjinjie@xxxxxxxxxx>
Date:   Sun Dec 11 10:33:37 2022 +0800

    of: overlay: fix null pointer dereferencing in find_dup_cset_node_entry() and find_dup_cset_prop()
    
    [ Upstream commit ee9d7a0e754568180a2f8ebc4aad226278a9116f ]
    
    When kmalloc() fail to allocate memory in kasprintf(), fn_1 or fn_2 will
    be NULL, and strcmp() will cause null pointer dereference.
    
    Fixes: 2fe0e8769df9 ("of: overlay: check prevents multiple fragments touching same property")
    Signed-off-by: ruanjinjie <ruanjinjie@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20221211023337.592266-1-ruanjinjie@xxxxxxxxxx
    Signed-off-by: Rob Herring <robh@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/of/overlay.c b/drivers/of/overlay.c
index c8a0c0e9dec1..67b404f36e79 100644
--- a/drivers/of/overlay.c
+++ b/drivers/of/overlay.c
@@ -547,7 +547,7 @@ static int find_dup_cset_node_entry(struct overlay_changeset *ovcs,
 
 		fn_1 = kasprintf(GFP_KERNEL, "%pOF", ce_1->np);
 		fn_2 = kasprintf(GFP_KERNEL, "%pOF", ce_2->np);
-		node_path_match = !strcmp(fn_1, fn_2);
+		node_path_match = !fn_1 || !fn_2 || !strcmp(fn_1, fn_2);
 		kfree(fn_1);
 		kfree(fn_2);
 		if (node_path_match) {
@@ -582,7 +582,7 @@ static int find_dup_cset_prop(struct overlay_changeset *ovcs,
 
 		fn_1 = kasprintf(GFP_KERNEL, "%pOF", ce_1->np);
 		fn_2 = kasprintf(GFP_KERNEL, "%pOF", ce_2->np);
-		node_path_match = !strcmp(fn_1, fn_2);
+		node_path_match = !fn_1 || !fn_2 || !strcmp(fn_1, fn_2);
 		kfree(fn_1);
 		kfree(fn_2);
 		if (node_path_match &&



[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