Patch "net: phylink: don't call netif_carrier_off() with NULL netdev" has been added to the 5.14-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    net: phylink: don't call netif_carrier_off() with NULL netdev

to the 5.14-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     net-phylink-don-t-call-netif_carrier_off-with-null-n.patch
and it can be found in the queue-5.14 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 9fb763e760d24cd445ba1036486ca27ce2c19140
Author: Russell King (Oracle) <rmk+kernel@xxxxxxxxxxxxxxx>
Date:   Fri Sep 17 14:36:31 2021 +0100

    net: phylink: don't call netif_carrier_off() with NULL netdev
    
    [ Upstream commit cbcca2e3961eac736566ac13ef0d0bf6f0b764ec ]
    
    Dan Carpenter points out that we have a code path that permits a NULL
    netdev pointer to be passed to netif_carrier_off(), which will cause
    a kernel oops. In any case, we need to set pl->old_link_state to false
    to have the desired effect when there is no netdev present.
    
    Fixes: f97493657c63 ("net: phylink: add suspend/resume support")
    Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
    Signed-off-by: Russell King (Oracle) <rmk+kernel@xxxxxxxxxxxxxxx>
    Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
index 0d3d9c3ee83c8..6e96d7b7ee445 100644
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
@@ -1332,7 +1332,10 @@ void phylink_suspend(struct phylink *pl, bool mac_wol)
 		 * but one would hope all packets have been sent. This
 		 * also means phylink_resolve() will do nothing.
 		 */
-		netif_carrier_off(pl->netdev);
+		if (pl->netdev)
+			netif_carrier_off(pl->netdev);
+		else
+			pl->old_link_state = false;
 
 		/* We do not call mac_link_down() here as we want the
 		 * link to remain up to receive the WoL packets.



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux