Revert "xsk: Fix race condition in AF_XDP generic RX path"
This reverts commit 65d3c57061 which is
commit a1356ac7749cafc4e27aa62c0c4604b5dca4983e upstream.
It breaks the Android kernel abi and can be brought back in the future
in an abi-safe way if it is really needed.
Bug: 161946584
Change-Id: I15acb18ebd9dd5a0d2fb0bf4153c5ced269f978a
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
@@ -71,6 +71,9 @@ struct xdp_sock {
|
|||||||
*/
|
*/
|
||||||
u32 tx_budget_spent;
|
u32 tx_budget_spent;
|
||||||
|
|
||||||
|
/* Protects generic receive. */
|
||||||
|
spinlock_t rx_lock;
|
||||||
|
|
||||||
/* Statistics */
|
/* Statistics */
|
||||||
u64 rx_dropped;
|
u64 rx_dropped;
|
||||||
u64 rx_queue_full;
|
u64 rx_queue_full;
|
||||||
|
|||||||
@@ -55,8 +55,6 @@ struct xsk_buff_pool {
|
|||||||
refcount_t users;
|
refcount_t users;
|
||||||
struct xdp_umem *umem;
|
struct xdp_umem *umem;
|
||||||
struct work_struct work;
|
struct work_struct work;
|
||||||
/* Protects generic receive in shared and non-shared umem mode. */
|
|
||||||
spinlock_t rx_lock;
|
|
||||||
struct list_head free_list;
|
struct list_head free_list;
|
||||||
struct list_head xskb_list;
|
struct list_head xskb_list;
|
||||||
u32 heads_cnt;
|
u32 heads_cnt;
|
||||||
|
|||||||
+3
-3
@@ -338,14 +338,13 @@ int xsk_generic_rcv(struct xdp_sock *xs, struct xdp_buff *xdp)
|
|||||||
u32 len = xdp_get_buff_len(xdp);
|
u32 len = xdp_get_buff_len(xdp);
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
|
spin_lock_bh(&xs->rx_lock);
|
||||||
err = xsk_rcv_check(xs, xdp, len);
|
err = xsk_rcv_check(xs, xdp, len);
|
||||||
if (!err) {
|
if (!err) {
|
||||||
spin_lock_bh(&xs->pool->rx_lock);
|
|
||||||
err = __xsk_rcv(xs, xdp, len);
|
err = __xsk_rcv(xs, xdp, len);
|
||||||
xsk_flush(xs);
|
xsk_flush(xs);
|
||||||
spin_unlock_bh(&xs->pool->rx_lock);
|
|
||||||
}
|
}
|
||||||
|
spin_unlock_bh(&xs->rx_lock);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1721,6 +1720,7 @@ static int xsk_create(struct net *net, struct socket *sock, int protocol,
|
|||||||
xs = xdp_sk(sk);
|
xs = xdp_sk(sk);
|
||||||
xs->state = XSK_READY;
|
xs->state = XSK_READY;
|
||||||
mutex_init(&xs->mutex);
|
mutex_init(&xs->mutex);
|
||||||
|
spin_lock_init(&xs->rx_lock);
|
||||||
|
|
||||||
INIT_LIST_HEAD(&xs->map_list);
|
INIT_LIST_HEAD(&xs->map_list);
|
||||||
spin_lock_init(&xs->map_list_lock);
|
spin_lock_init(&xs->map_list_lock);
|
||||||
|
|||||||
@@ -87,7 +87,6 @@ struct xsk_buff_pool *xp_create_and_assign_umem(struct xdp_sock *xs,
|
|||||||
pool->addrs = umem->addrs;
|
pool->addrs = umem->addrs;
|
||||||
pool->tx_metadata_len = umem->tx_metadata_len;
|
pool->tx_metadata_len = umem->tx_metadata_len;
|
||||||
pool->tx_sw_csum = umem->flags & XDP_UMEM_TX_SW_CSUM;
|
pool->tx_sw_csum = umem->flags & XDP_UMEM_TX_SW_CSUM;
|
||||||
spin_lock_init(&pool->rx_lock);
|
|
||||||
INIT_LIST_HEAD(&pool->free_list);
|
INIT_LIST_HEAD(&pool->free_list);
|
||||||
INIT_LIST_HEAD(&pool->xskb_list);
|
INIT_LIST_HEAD(&pool->xskb_list);
|
||||||
INIT_LIST_HEAD(&pool->xsk_tx_list);
|
INIT_LIST_HEAD(&pool->xsk_tx_list);
|
||||||
|
|||||||
Reference in New Issue
Block a user