Skip to content

Commit 7eced44

Browse files
jgross1gregkh
authored andcommitted
xen/netfront: don't bug in case of too many frags
commit ad4f15d upstream. 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]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent e2d5285 commit 7eced44

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
@@ -907,7 +907,11 @@ static RING_IDX xennet_fill_frags(struct netfront_queue *queue,
907907
BUG_ON(pull_to <= skb_headlen(skb));
908908
__pskb_pull_tail(skb, pull_to - skb_headlen(skb));
909909
}
910-
BUG_ON(skb_shinfo(skb)->nr_frags >= MAX_SKB_FRAGS);
910+
if (unlikely(skb_shinfo(skb)->nr_frags >= MAX_SKB_FRAGS)) {
911+
queue->rx.rsp_cons = ++cons;
912+
kfree_skb(nskb);
913+
return ~0U;
914+
}
911915

912916
skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags,
913917
skb_frag_page(nfrag),
@@ -1044,6 +1048,8 @@ static int xennet_poll(struct napi_struct *napi, int budget)
10441048
skb->len += rx->status;
10451049

10461050
i = xennet_fill_frags(queue, skb, &tmpq);
1051+
if (unlikely(i == ~0U))
1052+
goto err;
10471053

10481054
if (rx->flags & XEN_NETRXF_csum_blank)
10491055
skb->ip_summed = CHECKSUM_PARTIAL;

0 commit comments

Comments
 (0)