]> git.baikalelectronics.ru Git - kernel.git/commit
macvtap: correctly linearize skb when zerocopy is used
authorJason Wang <jasowang@redhat.com>
Wed, 10 Jul 2013 05:43:28 +0000 (13:43 +0800)
committerDavid S. Miller <davem@davemloft.net>
Thu, 11 Jul 2013 01:45:52 +0000 (18:45 -0700)
commitbbb8c0213d4feb70670f7bbaf9fa330524825728
treec7054c34dacaa95f2e4b63c61baf8227deab7581
parent057c9e690c2dbc40e38ab6313964575dd435f03a
macvtap: correctly linearize skb when zerocopy is used

Userspace may produce vectors greater than MAX_SKB_FRAGS. When we try to
linearize parts of the skb to let the rest of iov to be fit in
the frags, we need count copylen into linear when calling macvtap_alloc_skb()
instead of partly counting it into data_len. Since this breaks
zerocopy_sg_from_iovec() since its inner counter assumes nr_frags should
be zero at beginning. This cause nr_frags to be increased wrongly without
setting the correct frags.

This bug were introduced from d825bb96569ec9a6be0cbd28a33ef869e080d286
(macvtap: zerocopy: validate vectors before building skb).

Cc: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/macvtap.c