File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -56,6 +56,7 @@ static inline int virtio_net_hdr_to_skb(struct sk_buff *skb,
56
56
unsigned int thlen = 0 ;
57
57
unsigned int p_off = 0 ;
58
58
unsigned int ip_proto ;
59
+ u64 ret , remainder , gso_size ;
59
60
60
61
if (hdr -> gso_type != VIRTIO_NET_HDR_GSO_NONE ) {
61
62
switch (hdr -> gso_type & ~VIRTIO_NET_HDR_GSO_ECN ) {
@@ -98,6 +99,16 @@ static inline int virtio_net_hdr_to_skb(struct sk_buff *skb,
98
99
u32 off = __virtio16_to_cpu (little_endian , hdr -> csum_offset );
99
100
u32 needed = start + max_t (u32 , thlen , off + sizeof (__sum16 ));
100
101
102
+ if (hdr -> gso_size ) {
103
+ gso_size = __virtio16_to_cpu (little_endian , hdr -> gso_size );
104
+ ret = div64_u64_rem (skb -> len , gso_size , & remainder );
105
+ if (!(ret && (hdr -> gso_size > needed ) &&
106
+ ((remainder > needed ) || (remainder == 0 )))) {
107
+ return - EINVAL ;
108
+ }
109
+ skb_shinfo (skb )-> tx_flags |= SKBFL_SHARED_FRAG ;
110
+ }
111
+
101
112
if (!pskb_may_pull (skb , needed ))
102
113
return - EINVAL ;
103
114
You can’t perform that action at this time.
0 commit comments