Skip to contentSkip to conversation

FS_ENET: Don't attempt to set mii_speed when fec_inf is null

PATCH In review Nye Liu 2 participants 4 messages Jun 27, 2008

Subsystems (2)
lore
Share & tools
lore

Nye Liu

author
#0 lore raw

PATCH 1/1 FS_ENET: Don't attempt to set mii_speed when fec_inf is null

From: Nye Liu <[email protected]>

When using CONFIG_FIXED_PHY, fec_inf (fep->phydev->bus->priv) is NULL in fs_enet/mac-fec.c restart(). Dereferencing fec_inf when trying to set the mii_speed causes a kernel oops.

---

drivers/net/fs_enet/mac-fec.c +2 -1
index 8a311d1..350bc73 100644
@@ -328,7 +328,8 @@ static void restart(struct net_device *dev)
        /*
         * Set MII speed.
         */
-       FW(fecp, mii_speed, fec_inf->mii_speed);
+       if (fec_inf)
+           FW(fecp, mii_speed, fec_inf->mii_speed);
 
        /*
         * Clear any outstanding interrupt.
#1 lore raw

Hello.

Quoted 15 lines · Nye Liu

From: Nye Liu <[email protected]>

When using CONFIG_FIXED_PHY, fec_inf (fep->phydev->bus->priv) is NULL in fs_enet/mac-fec.c restart(). Dereferencing fec_inf when trying to set the mii_speed causes a kernel oops.

---

drivers/net/fs_enet/mac-fec.c +0 -0
index 8a311d1..350bc73 100644

drivers/net/fs_enet/mac-fec.c static void restart(struct net_device *dev) · line 333

Quoted 7 lines
drivers/net/fs_enet/mac-fec.c +2 -1
@@ -328,7 +328,8 @@ static void restart(struct net_device *dev)
        /*
         * Set MII speed.
         */
-       FW(fecp, mii_speed, fec_inf->mii_speed);
+       if (fec_inf)
+           FW(fecp, mii_speed, fec_inf->mii_speed);
 

Alas, Your patch is whitespace damaged.

WBR, Sergei

author
#2 lore raw

Sorry!

drivers/net/fs_enet/mac-fec.c +2 -1
index 8a311d1..7359068 100644
@@ -328,7 +328,8 @@ static void restart(struct net_device *dev)
 	/*
 	 * Set MII speed.
 	 */
-	FW(fecp, mii_speed, fec_inf->mii_speed);
+	if (fec_inf)
+		FW(fecp, mii_speed, fec_inf->mii_speed);
 
 	/*
 	 * Clear any outstanding interrupt.
Quoted 32 lines · Sergei Shtylyov

Hello.

Quoted 15 lines · Nye Liu

From: Nye Liu <[email protected]>

When using CONFIG_FIXED_PHY, fec_inf (fep->phydev->bus->priv) is NULL in fs_enet/mac-fec.c restart(). Dereferencing fec_inf when trying to set the mii_speed causes a kernel oops.

---

drivers/net/fs_enet/mac-fec.c +0 -0
index 8a311d1..350bc73 100644

drivers/net/fs_enet/mac-fec.c static void restart(struct net_device *dev) · line 333

Quoted 7 lines
drivers/net/fs_enet/mac-fec.c +2 -1
@@ -328,7 +328,8 @@ static void restart(struct net_device *dev)
        /*
         * Set MII speed.
         */
-       FW(fecp, mii_speed, fec_inf->mii_speed);
+       if (fec_inf)
+           FW(fecp, mii_speed, fec_inf->mii_speed);
 

Alas, Your patch is whitespace damaged.

WBR, Sergei

author
#3 lore raw

PATCH 1/1 FS_ENET: Don't attempt to set mii_speed when fec_inf is null

In reply to Nye Liu

From: Nye Liu <[email protected]>

When using CONFIG_FIXED_PHY, fec_inf (fep->phydev->bus->priv) is NULL in fs_enet/mac-fec.c restart(). Dereferencing fec_inf when trying to set the mii_speed causes a kernel oops.

---

drivers/net/fs_enet/mac-fec.c +2 -1
index 8a311d1..7359068 100644
@@ -328,7 +328,8 @@ static void restart(struct net_device *dev)
 	/*
 	 * Set MII speed.
 	 */
-	FW(fecp, mii_speed, fec_inf->mii_speed);
+	if (fec_inf)
+		FW(fecp, mii_speed, fec_inf->mii_speed);
 
 	/*
 	 * Clear any outstanding interrupt.