]> err.no Git - linux-2.6/commitdiff
[POWERPC] mpc5200-fec: Fix possible NULL dereference in mdio driver
authorGrant Likely <grant.likely@secretlab.ca>
Sat, 22 Mar 2008 03:20:29 +0000 (14:20 +1100)
committerPaul Mackerras <paulus@samba.org>
Mon, 24 Mar 2008 06:55:48 +0000 (17:55 +1100)
If the reg property is missing from the phy node (unlikely, but possible),
then the kernel will oops with a NULL pointer dereference.  This fixes
it by checking the pointer first.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Signed-off-by: Paul Mackerras <paulus@samba.org>
drivers/net/fec_mpc52xx_phy.c

index 1837584c4504dd82f56db27d9326d9763b3ffe83..6a3ac4ea97e90af21bc7ab0cb0cea66dad7cf7cd 100644 (file)
@@ -109,7 +109,8 @@ static int mpc52xx_fec_mdio_probe(struct of_device *of, const struct of_device_i
                int irq = irq_of_parse_and_map(child, 0);
                if (irq != NO_IRQ) {
                        const u32 *id = of_get_property(child, "reg", NULL);
-                       bus->irq[*id] = irq;
+                       if (id)
+                               bus->irq[*id] = irq;
                }
        }