diff --git a/net/xdp/xsk.c b/net/xdp/xsk.c index d04f91f4d09d..562d69f17b4c 100644 --- a/net/xdp/xsk.c +++ b/net/xdp/xsk.c @@ -895,6 +895,8 @@ static int xsk_setsockopt(struct socket *sock, int level, int optname, struct xsk_queue **q; int entries; + if (optlen < sizeof(entries)) + return -EINVAL; if (copy_from_sockptr(&entries, optval, sizeof(entries))) return -EFAULT;