Patch "samples/bpf: Fix possible deadlock in xdpsock" has been added to the 5.9-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

    samples/bpf: Fix possible deadlock in xdpsock

to the 5.9-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:
     samples-bpf-fix-possible-deadlock-in-xdpsock.patch
and it can be found in the queue-5.9 subdirectory.

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



commit ee24c74471e1a8555489da14c7290b845b79e1a2
Author: Magnus Karlsson <magnus.karlsson@xxxxxxxxx>
Date:   Thu Sep 10 10:31:05 2020 +0200

    samples/bpf: Fix possible deadlock in xdpsock
    
    [ Upstream commit 5a2a0dd88f0f267ac5953acd81050ae43a82201f ]
    
    Fix a possible deadlock in the l2fwd application in xdpsock that can
    occur when there is no space in the Tx ring. There are two ways to get
    the kernel to consume entries in the Tx ring: calling sendto() to make
    it send packets and freeing entries from the completion ring, as the
    kernel will not send a packet if there is no space for it to add a
    completion entry in the completion ring. The Tx loop in l2fwd only
    used to call sendto(). This patches adds cleaning the completion ring
    in that loop.
    
    Signed-off-by: Magnus Karlsson <magnus.karlsson@xxxxxxxxx>
    Signed-off-by: Alexei Starovoitov <ast@xxxxxxxxxx>
    Link: https://lore.kernel.org/bpf/1599726666-8431-3-git-send-email-magnus.karlsson@xxxxxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/samples/bpf/xdpsock_user.c b/samples/bpf/xdpsock_user.c
index c821e98671393..63a9a2a39da7b 100644
--- a/samples/bpf/xdpsock_user.c
+++ b/samples/bpf/xdpsock_user.c
@@ -1111,6 +1111,7 @@ static void l2fwd(struct xsk_socket_info *xsk, struct pollfd *fds)
 	while (ret != rcvd) {
 		if (ret < 0)
 			exit_with_error(-ret);
+		complete_tx_l2fwd(xsk, fds);
 		if (xsk_ring_prod__needs_wakeup(&xsk->tx))
 			kick_tx(xsk);
 		ret = xsk_ring_prod__reserve(&xsk->tx, rcvd, &idx_tx);



[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