[U-Boot] [PATCH] net, phy, cpsw: fix unaligned access if no phy found
if phy_connect() did not find a phy, phydev is not initialized and following code in cpsw_phy_init() maybe crashes. Fix this. Signed-off-by: Heiko Schocher h...@denx.de Cc: Joe Hershberger joe.hershber...@gmail.com Cc: Mugunthan V N mugunthan...@ti.com Cc: Tom Rini tr...@ti.com --- Found on the dxr2 board with no phy connected to the board, U-Boot crashes with: U-Boot 2013.07-12701-gea98378-dirty (Sep 04 2013 - 06:58:16) I2C: ready DRAM: 128 MiB Enable d-cache FactorySet is not right in eeprom. NAND: 256 MiB MMC: OMAP SD/MMC: 0, OMAP SD/MMC: 1 8-bit BCH HW ECC selected Net: Could not get PHY for cpsw: addr 0 data abort MAYBE you should read doc/README.arm-unaligned-accesses pc : [87f80574] lr : [87f80fcc] sp : 86f5aee0 ip : 0034 fp : 80100020 r10: 0014 r9 : 07e5d000 r8 : 86f5af30 r7 : 86f5f750 r6 : 86f5f804 r5 : 86f5f708 r4 : 86f5f750 r3 : r2 : r1 : 87fa4d08 r0 : Flags: nZCv IRQs off FIQs on Mode SVC_32 Resetting CPU ... resetting ... --- drivers/net/cpsw.c | 3 +++ 1 Datei geändert, 3 Zeilen hinzugefügt(+) diff --git a/drivers/net/cpsw.c b/drivers/net/cpsw.c index 9bab71a..b18d528 100644 --- a/drivers/net/cpsw.c +++ b/drivers/net/cpsw.c @@ -947,6 +947,9 @@ static int cpsw_phy_init(struct eth_device *dev, struct cpsw_slave *slave) dev, slave-data-phy_if); + if (!phydev) + return -1; + phydev-supported = supported; phydev-advertising = phydev-supported; -- 1.7.11.7 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] net, phy, cpsw: fix unaligned access if no phy found
On Wed, Sep 04, 2013 at 02:16:01PM +0200, Heiko Schocher wrote: if phy_connect() did not find a phy, phydev is not initialized and following code in cpsw_phy_init() maybe crashes. Fix this. Signed-off-by: Heiko Schocher h...@denx.de Cc: Joe Hershberger joe.hershber...@gmail.com Cc: Mugunthan V N mugunthan...@ti.com Cc: Tom Rini tr...@ti.com --- Found on the dxr2 board with no phy connected to the board, U-Boot crashes with: U-Boot 2013.07-12701-gea98378-dirty (Sep 04 2013 - 06:58:16) I2C: ready DRAM: 128 MiB Enable d-cache FactorySet is not right in eeprom. NAND: 256 MiB MMC: OMAP SD/MMC: 0, OMAP SD/MMC: 1 8-bit BCH HW ECC selected Net: Could not get PHY for cpsw: addr 0 data abort MAYBE you should read doc/README.arm-unaligned-accesses pc : [87f80574] lr : [87f80fcc] sp : 86f5aee0 ip : 0034 fp : 80100020 r10: 0014 r9 : 07e5d000 r8 : 86f5af30 r7 : 86f5f750 r6 : 86f5f804 r5 : 86f5f708 r4 : 86f5f750 r3 : r2 : r1 : 87fa4d08 r0 : Flags: nZCv IRQs off FIQs on Mode SVC_32 Resetting CPU ... resetting ... --- drivers/net/cpsw.c | 3 +++ 1 Datei ge??ndert, 3 Zeilen hinzugef??gt(+) diff --git a/drivers/net/cpsw.c b/drivers/net/cpsw.c index 9bab71a..b18d528 100644 --- a/drivers/net/cpsw.c +++ b/drivers/net/cpsw.c @@ -947,6 +947,9 @@ static int cpsw_phy_init(struct eth_device *dev, struct cpsw_slave *slave) dev, slave-data-phy_if); + if (!phydev) + return -1; + phydev-supported = supported; phydev-advertising = phydev-supported; This isn't really an unaligned access problem it's a NULL pointer dereference, so I'll re-word the commit message when I grab this for u-boot-ti soon. -- Tom signature.asc Description: Digital signature ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] net, phy, cpsw: fix unaligned access if no phy found
On Wed, Sep 4, 2013 at 7:16 AM, Heiko Schocher h...@denx.de wrote: if phy_connect() did not find a phy, phydev is not initialized and following code in cpsw_phy_init() maybe crashes. Fix this. Signed-off-by: Heiko Schocher h...@denx.de Cc: Joe Hershberger joe.hershber...@gmail.com Cc: Mugunthan V N mugunthan...@ti.com Cc: Tom Rini tr...@ti.com Acked-by: Joe Hershberger joe.hershber...@ni.com ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] net, phy, cpsw: fix unaligned access if no phy found
Hello Tom, Am 04.09.2013 15:14, schrieb Tom Rini: On Wed, Sep 04, 2013 at 02:16:01PM +0200, Heiko Schocher wrote: if phy_connect() did not find a phy, phydev is not initialized and following code in cpsw_phy_init() maybe crashes. Fix this. Signed-off-by: Heiko Schocherh...@denx.de Cc: Joe Hershbergerjoe.hershber...@gmail.com Cc: Mugunthan V Nmugunthan...@ti.com Cc: Tom Rinitr...@ti.com --- Found on the dxr2 board with no phy connected to the board, U-Boot crashes with: U-Boot 2013.07-12701-gea98378-dirty (Sep 04 2013 - 06:58:16) I2C: ready DRAM: 128 MiB Enable d-cache FactorySet is not right in eeprom. NAND: 256 MiB MMC: OMAP SD/MMC: 0, OMAP SD/MMC: 1 8-bit BCH HW ECC selected Net: Could not get PHY for cpsw: addr 0 data abort MAYBE you should read doc/README.arm-unaligned-accesses pc : [87f80574] lr : [87f80fcc] sp : 86f5aee0 ip : 0034 fp : 80100020 r10: 0014 r9 : 07e5d000 r8 : 86f5af30 r7 : 86f5f750 r6 : 86f5f804 r5 : 86f5f708 r4 : 86f5f750 r3 : r2 : r1 : 87fa4d08 r0 : Flags: nZCv IRQs off FIQs on Mode SVC_32 Resetting CPU ... resetting ... --- drivers/net/cpsw.c | 3 +++ 1 Datei ge??ndert, 3 Zeilen hinzugef??gt(+) diff --git a/drivers/net/cpsw.c b/drivers/net/cpsw.c index 9bab71a..b18d528 100644 --- a/drivers/net/cpsw.c +++ b/drivers/net/cpsw.c @@ -947,6 +947,9 @@ static int cpsw_phy_init(struct eth_device *dev, struct cpsw_slave *slave) dev, slave-data-phy_if); + if (!phydev) + return -1; + phydev-supported= supported; phydev-advertising = phydev-supported; This isn't really an unaligned access problem it's a NULL pointer dereference, so I'll re-word the commit message when I grab this for u-boot-ti soon. Yes, thanks ... Hmm.. there are also problems if starting tftp on such a hardware ... I found more issues in this driver ... I repost a v2 soon ... bye, Heiko -- DENX Software Engineering GmbH, MD: Wolfgang Denk Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot