projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
ad75646
)
xsk: proper queue id check at bind
author
Magnus Karlsson
<
[email protected]
>
Tue, 22 May 2018 07:34:58 +0000
(09:34 +0200)
committer
Daniel Borkmann
<
[email protected]
>
Tue, 22 May 2018 08:25:06 +0000
(10:25 +0200)
Validate the queue id against both Rx and Tx on the netdev. Also, make
sure that the queue exists at xmit time.
Reported-by: Jesper Dangaard Brouer <
[email protected]
>
Tested-by: Jesper Dangaard Brouer <
[email protected]
>
Signed-off-by: Magnus Karlsson <
[email protected]
>
Signed-off-by: Daniel Borkmann <
[email protected]
>
net/xdp/xsk.c
patch
|
blob
|
history
diff --git
a/net/xdp/xsk.c
b/net/xdp/xsk.c
index cb1acd7009f43f8c0f0bf916fd7ad501f509dd62..29707354cf785c2498e8f9e101bee8812a6d909a 100644
(file)
--- a/
net/xdp/xsk.c
+++ b/
net/xdp/xsk.c
@@
-142,6
+142,11
@@
static int xsk_generic_xmit(struct sock *sk, struct msghdr *m,
goto out;
}
+ if (xs->queue_id >= xs->dev->real_num_tx_queues) {
+ err = -ENXIO;
+ goto out;
+ }
+
skb = sock_alloc_send_skb(sk, len, !need_wait, &err);
if (unlikely(!skb)) {
err = -EAGAIN;
@@
-305,7
+310,8
@@
static int xsk_bind(struct socket *sock, struct sockaddr *addr, int addr_len)
goto out_unlock;
}
- if (sxdp->sxdp_queue_id >= dev->num_rx_queues) {
+ if ((xs->rx && sxdp->sxdp_queue_id >= dev->real_num_rx_queues) ||
+ (xs->tx && sxdp->sxdp_queue_id >= dev->real_num_tx_queues)) {
err = -EINVAL;
goto out_unlock;
}