From: Sieng Piaw Liew Date: Wed, 15 Jun 2022 03:24:26 +0000 (+0800) Subject: net: don't check skb_count twice X-Git-Tag: baikal/mips/sdk6.1~5155^2~359 X-Git-Url: https://git.baikalelectronics.ru/sdk/?a=commitdiff_plain;h=42b6eb87308af392a5d81cc7a411b68e4a7ee3da;p=kernel.git net: don't check skb_count twice NAPI cache skb_count is being checked twice without condition. Change to checking the second time only if the first check is run. Signed-off-by: Sieng Piaw Liew Signed-off-by: David S. Miller --- diff --git a/net/core/skbuff.c b/net/core/skbuff.c index fec75f8bf1f41..00bf35ee82051 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -175,13 +175,14 @@ static struct sk_buff *napi_skb_cache_get(void) struct napi_alloc_cache *nc = this_cpu_ptr(&napi_alloc_cache); struct sk_buff *skb; - if (unlikely(!nc->skb_count)) + if (unlikely(!nc->skb_count)) { nc->skb_count = kmem_cache_alloc_bulk(skbuff_head_cache, GFP_ATOMIC, NAPI_SKB_CACHE_BULK, nc->skb_cache); - if (unlikely(!nc->skb_count)) - return NULL; + if (unlikely(!nc->skb_count)) + return NULL; + } skb = nc->skb_cache[--nc->skb_count]; kasan_unpoison_object_data(skbuff_head_cache, skb);