File tree Expand file tree Collapse file tree 3 files changed +10
-5
lines changed Expand file tree Collapse file tree 3 files changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -2159,7 +2159,7 @@ int ldc_map_single(struct ldc_channel *lp,
21592159 state .pte_idx = (base - iommu -> page_table );
21602160 state .nc = 0 ;
21612161 fill_cookies (& state , (pa & PAGE_MASK ), (pa & ~PAGE_MASK ), len );
2162- BUG_ON (state .nc != 1 );
2162+ BUG_ON (state .nc > ncookies );
21632163
21642164 return state .nc ;
21652165}
Original file line number Diff line number Diff line change @@ -913,6 +913,9 @@ static int vnet_start_xmit(struct sk_buff *skb, struct net_device *dev)
913913 if (unlikely (!skb ))
914914 goto out_dropped ;
915915
916+ if (skb -> len > port -> rmtu )
917+ goto out_dropped ;
918+
916919 spin_lock_irqsave (& port -> vio .lock , flags );
917920
918921 dr = & port -> vio .drings [VIO_DRIVER_TX_RING ];
@@ -944,7 +947,7 @@ static int vnet_start_xmit(struct sk_buff *skb, struct net_device *dev)
944947 skb = NULL ;
945948
946949 err = ldc_map_single (port -> vio .lp , start , nlen ,
947- port -> tx_bufs [txi ].cookies , 2 ,
950+ port -> tx_bufs [txi ].cookies , VNET_MAXCOOKIES ,
948951 (LDC_MAP_SHADOW | LDC_MAP_DIRECT | LDC_MAP_RW ));
949952 if (err < 0 ) {
950953 netdev_info (dev , "tx buffer map error %d\n" , err );
@@ -1182,7 +1185,7 @@ static void vnet_set_rx_mode(struct net_device *dev)
11821185
11831186static int vnet_change_mtu (struct net_device * dev , int new_mtu )
11841187{
1185- if (new_mtu != ETH_DATA_LEN )
1188+ if (new_mtu < 68 || new_mtu > 65535 )
11861189 return - EINVAL ;
11871190
11881191 dev -> mtu = new_mtu ;
Original file line number Diff line number Diff line change 1616 */
1717#define VNET_CLEAN_TIMEOUT ((HZ/100)+1)
1818
19- #define VNET_MAXPACKET 1518ULL /* ETH_FRAMELEN + VLAN_HDR */
19+ #define VNET_MAXPACKET (65535ULL + ETH_HLEN + VLAN_HLEN)
2020#define VNET_TX_RING_SIZE 512
2121#define VNET_TX_WAKEUP_THRESH (dr ) ((dr)->pending / 4)
2222
2626 */
2727#define VNET_PACKET_SKIP 6
2828
29+ #define VNET_MAXCOOKIES (VNET_MAXPACKET/PAGE_SIZE + 1)
30+
2931struct vnet_tx_entry {
3032 struct sk_buff * skb ;
3133 unsigned int ncookies ;
32- struct ldc_trans_cookie cookies [2 ];
34+ struct ldc_trans_cookie cookies [VNET_MAXCOOKIES ];
3335};
3436
3537struct vnet ;
You can’t perform that action at this time.
0 commit comments