diff options
-rw-r--r-- | net/xdp/xdp_umem.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/net/xdp/xdp_umem.c b/net/xdp/xdp_umem.c index 16d5f353163a..3049af269fbf 100644 --- a/net/xdp/xdp_umem.c +++ b/net/xdp/xdp_umem.c | |||
@@ -27,6 +27,9 @@ void xdp_add_sk_umem(struct xdp_umem *umem, struct xdp_sock *xs) | |||
27 | { | 27 | { |
28 | unsigned long flags; | 28 | unsigned long flags; |
29 | 29 | ||
30 | if (!xs->tx) | ||
31 | return; | ||
32 | |||
30 | spin_lock_irqsave(&umem->xsk_list_lock, flags); | 33 | spin_lock_irqsave(&umem->xsk_list_lock, flags); |
31 | list_add_rcu(&xs->list, &umem->xsk_list); | 34 | list_add_rcu(&xs->list, &umem->xsk_list); |
32 | spin_unlock_irqrestore(&umem->xsk_list_lock, flags); | 35 | spin_unlock_irqrestore(&umem->xsk_list_lock, flags); |
@@ -36,6 +39,9 @@ void xdp_del_sk_umem(struct xdp_umem *umem, struct xdp_sock *xs) | |||
36 | { | 39 | { |
37 | unsigned long flags; | 40 | unsigned long flags; |
38 | 41 | ||
42 | if (!xs->tx) | ||
43 | return; | ||
44 | |||
39 | spin_lock_irqsave(&umem->xsk_list_lock, flags); | 45 | spin_lock_irqsave(&umem->xsk_list_lock, flags); |
40 | list_del_rcu(&xs->list); | 46 | list_del_rcu(&xs->list); |
41 | spin_unlock_irqrestore(&umem->xsk_list_lock, flags); | 47 | spin_unlock_irqrestore(&umem->xsk_list_lock, flags); |