|
@@ -760,6 +760,8 @@ static ssize_t macvtap_get_user(struct macvtap_queue *q, struct msghdr *m,
|
|
|
macvtap16_to_cpu(q, vnet_hdr.hdr_len) : GOODCOPY_LEN;
|
|
|
if (copylen > good_linear)
|
|
|
copylen = good_linear;
|
|
|
+ else if (copylen < ETH_HLEN)
|
|
|
+ copylen = ETH_HLEN;
|
|
|
linear = copylen;
|
|
|
i = *from;
|
|
|
iov_iter_advance(&i, copylen);
|
|
@@ -769,10 +771,11 @@ static ssize_t macvtap_get_user(struct macvtap_queue *q, struct msghdr *m,
|
|
|
|
|
|
if (!zerocopy) {
|
|
|
copylen = len;
|
|
|
- if (macvtap16_to_cpu(q, vnet_hdr.hdr_len) > good_linear)
|
|
|
+ linear = macvtap16_to_cpu(q, vnet_hdr.hdr_len);
|
|
|
+ if (linear > good_linear)
|
|
|
linear = good_linear;
|
|
|
- else
|
|
|
- linear = macvtap16_to_cpu(q, vnet_hdr.hdr_len);
|
|
|
+ else if (linear < ETH_HLEN)
|
|
|
+ linear = ETH_HLEN;
|
|
|
}
|
|
|
|
|
|
skb = macvtap_alloc_skb(&q->sk, MACVTAP_RESERVE, copylen,
|