]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
powerpc/pseries: Add null property check to pseries_discover_pic()
authorSuraj Jitindar Singh <sjitindarsingh@gmail.com>
Thu, 28 Apr 2016 05:53:45 +0000 (15:53 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Wed, 11 May 2016 11:54:03 +0000 (21:54 +1000)
The return value of of_get_property() isn't checked before it is passed
to the strstr() function, if it happens that the return value is null
then this will result in a null pointer being dereferenced.

Add a check to see if the return value of of_get_property() is null and
if it is continue straight on to the next node.

Signed-off-by: Suraj Jitindar Singh <sjitindarsingh@gmail.com>
Reviewed-by: Chris Smart <chris@distroguy.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/platforms/pseries/setup.c

index 6e944fc6e5f979d2559fd805970a81af7886315f..fa734943bcbc23f7d0a32d79f49b1fe3228433ae 100644 (file)
@@ -235,6 +235,8 @@ static void __init pseries_discover_pic(void)
 
        for_each_node_by_name(np, "interrupt-controller") {
                typep = of_get_property(np, "compatible", NULL);
+               if (!typep)
+                       continue;
                if (strstr(typep, "open-pic")) {
                        pSeries_mpic_node = of_node_get(np);
                        ppc_md.init_IRQ       = pseries_mpic_init_IRQ;