xsk: re-add queue id check for XDP_SKB path
authorBjörn Töpel <bjorn.topel@intel.com>
Tue, 12 Jun 2018 10:02:56 +0000 (12:02 +0200)
committerDaniel Borkmann <daniel@iogearbox.net>
Tue, 12 Jun 2018 10:19:04 +0000 (12:19 +0200)
Commit 173d3adb6f43 ("xsk: add zero-copy support for Rx") introduced a
regression on the XDP_SKB receive path, when the queue id checks were
removed. Now, they are back again.

Fixes: 173d3adb6f43 ("xsk: add zero-copy support for Rx")
Reported-by: Qi Zhang <qi.z.zhang@intel.com>
Signed-off-by: Björn Töpel <bjorn.topel@intel.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
net/xdp/xsk.c

index 36919a254ba370c37b4e199bfd68c285e25fdeb6..3b3410ada0971abe28eb53ee57eca5307b314761 100644 (file)
@@ -118,6 +118,9 @@ int xsk_generic_rcv(struct xdp_sock *xs, struct xdp_buff *xdp)
        u64 addr;
        int err;
 
+       if (xs->dev != xdp->rxq->dev || xs->queue_id != xdp->rxq->queue_index)
+               return -EINVAL;
+
        if (!xskq_peek_addr(xs->umem->fq, &addr) ||
            len > xs->umem->chunk_size_nohr) {
                xs->rx_dropped++;