Code Review
/
kvmfornfv.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Upgrade to 4.4.50-rt62
[kvmfornfv.git]
/
kernel
/
drivers
/
net
/
macvtap.c
diff --git
a/kernel/drivers/net/macvtap.c
b/kernel/drivers/net/macvtap.c
index
0fc5219
..
79de960
100644
(file)
--- a/
kernel/drivers/net/macvtap.c
+++ b/
kernel/drivers/net/macvtap.c
@@
-725,7
+725,7
@@
static ssize_t macvtap_get_user(struct macvtap_queue *q, struct msghdr *m,
ssize_t n;
if (q->flags & IFF_VNET_HDR) {
ssize_t n;
if (q->flags & IFF_VNET_HDR) {
- vnet_hdr_len =
q->vnet_hdr_sz
;
+ vnet_hdr_len =
READ_ONCE(q->vnet_hdr_sz)
;
err = -EINVAL;
if (len < vnet_hdr_len)
err = -EINVAL;
if (len < vnet_hdr_len)
@@
-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;
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);
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 (!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;
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,
}
skb = macvtap_alloc_skb(&q->sk, MACVTAP_RESERVE, copylen,
@@
-862,7
+865,7
@@
static ssize_t macvtap_put_user(struct macvtap_queue *q,
if (q->flags & IFF_VNET_HDR) {
struct virtio_net_hdr vnet_hdr;
if (q->flags & IFF_VNET_HDR) {
struct virtio_net_hdr vnet_hdr;
- vnet_hdr_len =
q->vnet_hdr_sz
;
+ vnet_hdr_len =
READ_ONCE(q->vnet_hdr_sz)
;
if (iov_iter_count(iter) < vnet_hdr_len)
return -EINVAL;
if (iov_iter_count(iter) < vnet_hdr_len)
return -EINVAL;