浏览代码

[POWERPC] mpc5200-fec: Fix possible NULL dereference in mdio driver

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>
Grant Likely 17 年之前
父节点
当前提交
b8c19eb16a
共有 1 个文件被更改,包括 2 次插入1 次删除
  1. 2 1
      drivers/net/fec_mpc52xx_phy.c

+ 2 - 1
drivers/net/fec_mpc52xx_phy.c

@@ -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;
 		}
 	}