]> git.baikalelectronics.ru Git - kernel.git/commit
tuntap: correctly linearize skb when zerocopy is used
authorJason Wang <jasowang@redhat.com>
Wed, 10 Jul 2013 05:43:27 +0000 (13:43 +0800)
committerDavid S. Miller <davem@davemloft.net>
Thu, 11 Jul 2013 01:45:52 +0000 (18:45 -0700)
commit057c9e690c2dbc40e38ab6313964575dd435f03a
treefe4138595758de2c756740239bf214a819b490d4
parent79a657256f729ddb68f2d7296affdbd37bf972af
tuntap: 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 tun_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 2b75cd6fcd7e619f53bfd80cc6bb4da45a8b6c39
(tun: experimental zero copy tx support)

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/tun.c