]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/blobdiff - drivers/net/tap.c
tuntap: add sanity checks about msg_controllen in sendmsg
[mirror_ubuntu-focal-kernel.git] / drivers / net / tap.c
index f285422a8071734e01711fc40ff5997e52df07f5..f870d08bb1f8685022c015998883b07b46a495c2 100644 (file)
@@ -1214,7 +1214,8 @@ static int tap_sendmsg(struct socket *sock, struct msghdr *m,
        struct xdp_buff *xdp;
        int i;
 
-       if (ctl && (ctl->type == TUN_MSG_PTR)) {
+       if (m->msg_controllen == sizeof(struct tun_msg_ctl) &&
+           ctl && ctl->type == TUN_MSG_PTR) {
                for (i = 0; i < ctl->num; i++) {
                        xdp = &((struct xdp_buff *)ctl->ptr)[i];
                        tap_get_user_xdp(q, xdp);