Merge tag 'trace-v6.5-2' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux...
[linux-2.6-microblaze.git] / net / xdp / xsk.c
index 5a8c0dd..31dca4e 100644 (file)
@@ -886,6 +886,7 @@ static int xsk_bind(struct socket *sock, struct sockaddr *addr, int addr_len)
        struct sock *sk = sock->sk;
        struct xdp_sock *xs = xdp_sk(sk);
        struct net_device *dev;
+       int bound_dev_if;
        u32 flags, qid;
        int err = 0;
 
@@ -899,6 +900,10 @@ static int xsk_bind(struct socket *sock, struct sockaddr *addr, int addr_len)
                      XDP_USE_NEED_WAKEUP))
                return -EINVAL;
 
+       bound_dev_if = READ_ONCE(sk->sk_bound_dev_if);
+       if (bound_dev_if && bound_dev_if != sxdp->sxdp_ifindex)
+               return -EINVAL;
+
        rtnl_lock();
        mutex_lock(&xs->mutex);
        if (xs->state != XSK_READY) {