Patch "alx: acquire mutex for alx_reinit in alx_change_mtu" has been added to the 5.16-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

    alx: acquire mutex for alx_reinit in alx_change_mtu

to the 5.16-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:
     alx-acquire-mutex-for-alx_reinit-in-alx_change_mtu.patch
and it can be found in the queue-5.16 subdirectory.

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



commit 9135c175a0c7ca4b4509859901f3e568f44ef721
Author: Niels Dossche <dossche.niels@xxxxxxxxx>
Date:   Fri Mar 11 00:27:08 2022 +0100

    alx: acquire mutex for alx_reinit in alx_change_mtu
    
    [ Upstream commit 46b348fd2d81a341b15fb3f3f986204b038f5c42 ]
    
    alx_reinit has a lockdep assertion that the alx->mtx mutex must be held.
    alx_reinit is called from two places: alx_reset and alx_change_mtu.
    alx_reset does acquire alx->mtx before calling alx_reinit.
    alx_change_mtu does not acquire this mutex, nor do its callers or any
    path towards alx_change_mtu.
    Acquire the mutex in alx_change_mtu.
    
    The issue was introduced when the fine-grained locking was introduced
    to the code to replace the RTNL. The same commit also introduced the
    lockdep assertion.
    
    Fixes: 4a5fe57e7751 ("alx: use fine-grained locking instead of RTNL")
    Signed-off-by: Niels Dossche <dossche.niels@xxxxxxxxx>
    Link: https://lore.kernel.org/r/20220310232707.44251-1-dossche.niels@xxxxxxxxx
    Signed-off-by: Jakub Kicinski <kuba@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/net/ethernet/atheros/alx/main.c b/drivers/net/ethernet/atheros/alx/main.c
index 4ad3fc72e74e..a89b93cb4e26 100644
--- a/drivers/net/ethernet/atheros/alx/main.c
+++ b/drivers/net/ethernet/atheros/alx/main.c
@@ -1181,8 +1181,11 @@ static int alx_change_mtu(struct net_device *netdev, int mtu)
 	alx->hw.mtu = mtu;
 	alx->rxbuf_size = max(max_frame, ALX_DEF_RXBUF_SIZE);
 	netdev_update_features(netdev);
-	if (netif_running(netdev))
+	if (netif_running(netdev)) {
+		mutex_lock(&alx->mtx);
 		alx_reinit(alx);
+		mutex_unlock(&alx->mtx);
+	}
 	return 0;
 }
 



[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