tap: fix use-after-free
authorMichael S. Tsirkin <mst@redhat.com>
Thu, 25 Jan 2018 23:36:31 +0000 (01:36 +0200)
committerDavid S. Miller <davem@davemloft.net>
Mon, 29 Jan 2018 17:02:53 +0000 (12:02 -0500)
Lockless access to __ptr_ring_full is only legal if ring is
never resized, otherwise it might cause use-after free errors.
Simply drop the lockless test, we'll drop the packet
a bit later when produce fails.

Fixes: 362899b8 ("macvtap: switch to use skb array")
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/tap.c

index 7c38659b2a767a2330e2e6dae778276086ef40af..77872699c45db5ea743c5d20e0d899fdb23cc321 100644 (file)
@@ -330,9 +330,6 @@ rx_handler_result_t tap_handle_frame(struct sk_buff **pskb)
        if (!q)
                return RX_HANDLER_PASS;
 
-       if (__ptr_ring_full(&q->ring))
-               goto drop;
-
        skb_push(skb, ETH_HLEN);
 
        /* Apply the forward feature mask so that we perform segmentation