Skip to content

Commit 2758fbb

Browse files
jgross1merwick
authored andcommitted
xen/netfront: don't bug in case of too many frags
Commit 57f230a ("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: 57f230a ("xen/netfront: raise max number of slots in xennet_get_responses()") Cc: [email protected] Signed-off-by: Juergen Gross <[email protected]> Signed-off-by: David S. Miller <[email protected]> (cherry picked from commit ad4f15d) Orabug: 28671425 Signed-off-by: Liam Merwick <[email protected]> Reviewed-by: Darren Kenny <[email protected]> Tested-by: Boris Ostrovsky <[email protected]>
1 parent e2d4896 commit 2758fbb

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

drivers/net/xen-netfront.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1144,7 +1144,11 @@ static RING_IDX xennet_fill_frags(struct netfront_queue *queue,
11441144
BUG_ON(pull_to <= skb_headlen(skb));
11451145
__pskb_pull_tail(skb, pull_to - skb_headlen(skb));
11461146
}
1147-
BUG_ON(skb_shinfo(skb)->nr_frags >= MAX_SKB_FRAGS);
1147+
if (unlikely(skb_shinfo(skb)->nr_frags >= MAX_SKB_FRAGS)) {
1148+
queue->rx.rsp_cons = ++cons;
1149+
kfree_skb(nskb);
1150+
return ~0U;
1151+
}
11481152

11491153
xennet_page_ref_inc(queue, page, ref);
11501154

@@ -1318,6 +1322,8 @@ static int xennet_poll(struct napi_struct *napi, int budget)
13181322
xennet_page_ref_inc(queue, page, ref);
13191323

13201324
i = xennet_fill_frags(queue, skb, &tmpq);
1325+
if (unlikely(i == ~0U))
1326+
goto err;
13211327

13221328
if (rx->flags & XEN_NETRXF_csum_blank)
13231329
skb->ip_summed = CHECKSUM_PARTIAL;

0 commit comments

Comments
 (0)