mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	xen/netfront: don't bug in case of too many frags
Commit57f230ab04("xen/netfront: raise max number of slots in xennet_get_responses()") raised the max number of allowed slots by one. This seems to be problematic in some configurations with netback using a larger MAX_SKB_FRAGS value (e.g. old Linux kernel with MAX_SKB_FRAGS defined as 18 instead of nowadays 17). Instead of BUG_ON() in this case just fall back to retransmission. Fixes:57f230ab04("xen/netfront: raise max number of slots in xennet_get_responses()") Cc: stable@vger.kernel.org Signed-off-by: Juergen Gross <jgross@suse.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
		
							parent
							
								
									22d0bd82cc
								
							
						
					
					
						commit
						ad4f15dc2c
					
				
					 1 changed files with 7 additions and 1 deletions
				
			
		| 
						 | 
					@ -908,7 +908,11 @@ static RING_IDX xennet_fill_frags(struct netfront_queue *queue,
 | 
				
			||||||
			BUG_ON(pull_to <= skb_headlen(skb));
 | 
								BUG_ON(pull_to <= skb_headlen(skb));
 | 
				
			||||||
			__pskb_pull_tail(skb, pull_to - skb_headlen(skb));
 | 
								__pskb_pull_tail(skb, pull_to - skb_headlen(skb));
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		BUG_ON(skb_shinfo(skb)->nr_frags >= MAX_SKB_FRAGS);
 | 
							if (unlikely(skb_shinfo(skb)->nr_frags >= MAX_SKB_FRAGS)) {
 | 
				
			||||||
 | 
								queue->rx.rsp_cons = ++cons;
 | 
				
			||||||
 | 
								kfree_skb(nskb);
 | 
				
			||||||
 | 
								return ~0U;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags,
 | 
							skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags,
 | 
				
			||||||
				skb_frag_page(nfrag),
 | 
									skb_frag_page(nfrag),
 | 
				
			||||||
| 
						 | 
					@ -1045,6 +1049,8 @@ static int xennet_poll(struct napi_struct *napi, int budget)
 | 
				
			||||||
		skb->len += rx->status;
 | 
							skb->len += rx->status;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		i = xennet_fill_frags(queue, skb, &tmpq);
 | 
							i = xennet_fill_frags(queue, skb, &tmpq);
 | 
				
			||||||
 | 
							if (unlikely(i == ~0U))
 | 
				
			||||||
 | 
								goto err;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (rx->flags & XEN_NETRXF_csum_blank)
 | 
							if (rx->flags & XEN_NETRXF_csum_blank)
 | 
				
			||||||
			skb->ip_summed = CHECKSUM_PARTIAL;
 | 
								skb->ip_summed = CHECKSUM_PARTIAL;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue