Patch "ethernet: rocker: fix sleep in atomic context bug in neigh_timer_handler" has been added to the 4.19-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

    ethernet: rocker: fix sleep in atomic context bug in neigh_timer_handler

to the 4.19-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:
     ethernet-rocker-fix-sleep-in-atomic-context-bug-in-n.patch
and it can be found in the queue-4.19 subdirectory.

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



commit b9181c6697e0191a94ad02def1ea54507fe2e56c
Author: Duoming Zhou <duoming@xxxxxxxxxx>
Date:   Sat Aug 27 23:38:15 2022 +0800

    ethernet: rocker: fix sleep in atomic context bug in neigh_timer_handler
    
    [ Upstream commit c0955bf957be4bead01fae1d791476260da7325d ]
    
    The function neigh_timer_handler() is a timer handler that runs in an
    atomic context. When used by rocker, neigh_timer_handler() calls
    "kzalloc(.., GFP_KERNEL)" that may sleep. As a result, the sleep in
    atomic context bug will happen. One of the processes is shown below:
    
    ofdpa_fib4_add()
     ...
     neigh_add_timer()
    
    (wait a timer)
    
    neigh_timer_handler()
     neigh_release()
      neigh_destroy()
       rocker_port_neigh_destroy()
        rocker_world_port_neigh_destroy()
         ofdpa_port_neigh_destroy()
          ofdpa_port_ipv4_neigh()
           kzalloc(sizeof(.., GFP_KERNEL) //may sleep
    
    This patch changes the gfp_t parameter of kzalloc() from GFP_KERNEL to
    GFP_ATOMIC in order to mitigate the bug.
    
    Fixes: 00fc0c51e35b ("rocker: Change world_ops API and implementation to be switchdev independant")
    Signed-off-by: Duoming Zhou <duoming@xxxxxxxxxx>
    Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/net/ethernet/rocker/rocker_ofdpa.c b/drivers/net/ethernet/rocker/rocker_ofdpa.c
index 6473cc68c2d5c..4039e1fc6e92a 100644
--- a/drivers/net/ethernet/rocker/rocker_ofdpa.c
+++ b/drivers/net/ethernet/rocker/rocker_ofdpa.c
@@ -1276,7 +1276,7 @@ static int ofdpa_port_ipv4_neigh(struct ofdpa_port *ofdpa_port,
 	bool removing;
 	int err = 0;
 
-	entry = kzalloc(sizeof(*entry), GFP_KERNEL);
+	entry = kzalloc(sizeof(*entry), GFP_ATOMIC);
 	if (!entry)
 		return -ENOMEM;
 



[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