Patch "lan743x: fix for potential NULL pointer dereference with bare card" has been added to the 5.10-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

    lan743x: fix for potential NULL pointer dereference with bare card

to the 5.10-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:
     lan743x-fix-for-potential-null-pointer-dereference-w.patch
and it can be found in the queue-5.10 subdirectory.

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



commit 424ca6f0f8d94d59316320866b8e41b1ab614b1a
Author: Sergej Bauer <sbauer@xxxxxxxxxxx>
Date:   Mon Nov 2 01:35:55 2020 +0300

    lan743x: fix for potential NULL pointer dereference with bare card
    
    [ Upstream commit e9e13b6adc338be1eb88db87bcb392696144bd02 ]
    
    This is the 3rd revision of the patch fix for potential null pointer dereference
    with lan743x card.
    
    The simpliest way to reproduce: boot with bare lan743x and issue "ethtool ethN"
    commant where ethN is the interface with lan743x card. Example:
    
    $ sudo ethtool eth7
    dmesg:
    [  103.510336] BUG: kernel NULL pointer dereference, address: 0000000000000340
    ...
    [  103.510836] RIP: 0010:phy_ethtool_get_wol+0x5/0x30 [libphy]
    ...
    [  103.511629] Call Trace:
    [  103.511666]  lan743x_ethtool_get_wol+0x21/0x40 [lan743x]
    [  103.511724]  dev_ethtool+0x1507/0x29d0
    [  103.511769]  ? avc_has_extended_perms+0x17f/0x440
    [  103.511820]  ? tomoyo_init_request_info+0x84/0x90
    [  103.511870]  ? tomoyo_path_number_perm+0x68/0x1e0
    [  103.511919]  ? tty_insert_flip_string_fixed_flag+0x82/0xe0
    [  103.511973]  ? inet_ioctl+0x187/0x1d0
    [  103.512016]  dev_ioctl+0xb5/0x560
    [  103.512055]  sock_do_ioctl+0xa0/0x140
    [  103.512098]  sock_ioctl+0x2cb/0x3c0
    [  103.512139]  __x64_sys_ioctl+0x84/0xc0
    [  103.512183]  do_syscall_64+0x33/0x80
    [  103.512224]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
    [  103.512274] RIP: 0033:0x7f54a9cba427
    ...
    
    Previous versions can be found at:
    v1:
    initial version
        https://lkml.org/lkml/2020/10/28/921
    
    v2:
    do not return from lan743x_ethtool_set_wol if netdev->phydev == NULL, just skip
    the call of phy_ethtool_set_wol() instead.
        https://lkml.org/lkml/2020/10/31/380
    
    v3:
    in function lan743x_ethtool_set_wol:
    use ternary operator instead of if-else sentence (review by Markus Elfring)
    return -ENETDOWN insted of -EIO (review by Andrew Lunn)
    
    Signed-off-by: Sergej Bauer <sbauer@xxxxxxxxxxx>
    
    Link: https://lore.kernel.org/r/20201101223556.16116-1-sbauer@xxxxxxxxxxx
    Signed-off-by: Jakub Kicinski <kuba@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/net/ethernet/microchip/lan743x_ethtool.c b/drivers/net/ethernet/microchip/lan743x_ethtool.c
index dcde496da7fb4..c5de8f46cdd35 100644
--- a/drivers/net/ethernet/microchip/lan743x_ethtool.c
+++ b/drivers/net/ethernet/microchip/lan743x_ethtool.c
@@ -780,7 +780,9 @@ static void lan743x_ethtool_get_wol(struct net_device *netdev,
 
 	wol->supported = 0;
 	wol->wolopts = 0;
-	phy_ethtool_get_wol(netdev->phydev, wol);
+
+	if (netdev->phydev)
+		phy_ethtool_get_wol(netdev->phydev, wol);
 
 	wol->supported |= WAKE_BCAST | WAKE_UCAST | WAKE_MCAST |
 		WAKE_MAGIC | WAKE_PHY | WAKE_ARP;
@@ -809,9 +811,8 @@ static int lan743x_ethtool_set_wol(struct net_device *netdev,
 
 	device_set_wakeup_enable(&adapter->pdev->dev, (bool)wol->wolopts);
 
-	phy_ethtool_set_wol(netdev->phydev, wol);
-
-	return 0;
+	return netdev->phydev ? phy_ethtool_set_wol(netdev->phydev, wol)
+			: -ENETDOWN;
 }
 #endif /* CONFIG_PM */
 




[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