Thread (73 messages) flat view 73 messages, 4 authors, 2021-07-09

Re: [PATCH v2 1/4] net: tun: fix tun_xdp_one() for IFF_TUN mode

From: David Woodhouse <dwmw2@infradead.org>
Date: 2021-06-23 17:31:09

On Wed, 2021-06-23 at 14:52 +0100, David Woodhouse wrote:
quoted hunk ↗ jump to hunk
@@ -2343,6 +2351,17 @@ static int tun_xdp_one(struct tun_struct *tun,
        if (tun->flags & IFF_VNET_HDR)
                gso = &hdr->gso;
 
+       if (!(tun->flags & IFF_NO_PI)) {
+               struct tun_pi *pi = xdp->data;
+               if (datasize < sizeof(*pi)) {
+                       atomic_long_inc(&tun->rx_frame_errors);
+                       return  -EINVAL;
+               }
+               proto = pi->proto;
+               reservelen += sizeof(*pi);
+               datasize -= sizeof(*pi);
+       }
+
        xdp_prog = rcu_dereference(tun->xdp_prog);
        if (xdp_prog) {
                if (gso && gso->gso_type) {
Joy... that's wrong because when tun does both the PI and the vnet
headers, the PI header comes *first*. When tun does only PI and vhost
does the vnet headers, they come in the other order.

Will fix (and adjust the test cases to cope).

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help