From: Yevgeny Petrilin Date: Sun, 26 Apr 2009 20:42:57 +0000 (+0000) Subject: mlx4_en: Handle page allocation failure during receive X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=785a0982eaaeae2fbe3372d1c9c769e8156a7a5a;p=openwrt%2Fstaging%2Fblogic.git mlx4_en: Handle page allocation failure during receive If we failed to allocate new fragments for receive buffer, the packet should be dropped and packets should be reused. Signed-off-by: Yevgeny Petrilin Signed-off-by: David S. Miller --- diff --git a/drivers/net/mlx4/en_rx.c b/drivers/net/mlx4/en_rx.c index 0cbb78ca7b29..7942c4d3cd88 100644 --- a/drivers/net/mlx4/en_rx.c +++ b/drivers/net/mlx4/en_rx.c @@ -610,6 +610,10 @@ static struct sk_buff *mlx4_en_rx_skb(struct mlx4_en_priv *priv, used_frags = mlx4_en_complete_rx_desc(priv, rx_desc, skb_frags, skb_shinfo(skb)->frags, page_alloc, length); + if (unlikely(!used_frags)) { + kfree_skb(skb); + return NULL; + } skb_shinfo(skb)->nr_frags = used_frags; /* Copy headers into the skb linear buffer */