macvtap: zerocopy: validate vectors before building skb
authorJason Wang <jasowang@redhat.com>
Wed, 2 May 2012 03:42:15 +0000 (11:42 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 16 Jul 2012 16:04:42 +0000 (09:04 -0700)
commit6d0535e8f0406ba353c06a5417e9caa498733372
treebac8428aa8261f7faa92ea9cebc177896953ab0c
parent21359ac3aef0455038f6295d6f8b3aca7beabfd9
macvtap: zerocopy: validate vectors before building skb

commit b92946e2919134ebe2a4083e4302236295ea2a73 upstream.

There're several reasons that the vectors need to be validated:

- Return error when caller provides vectors whose num is greater than UIO_MAXIOV.
- Linearize part of skb when userspace provides vectors grater than MAX_SKB_FRAGS.
- Return error when userspace provides vectors whose total length may exceed
- MAX_SKB_FRAGS * PAGE_SIZE.

Signed-off-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Cc: Josh Boyer <jwboyer@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/macvtap.c