Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
authorJakub Kicinski <kuba@kernel.org>
Thu, 11 May 2023 16:06:26 +0000 (09:06 -0700)
committerJakub Kicinski <kuba@kernel.org>
Thu, 11 May 2023 16:06:55 +0000 (09:06 -0700)
Cross-merge networking fixes. No conflicts.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1  2 
net/core/skbuff.c

diff --combined net/core/skbuff.c
@@@ -92,7 -92,15 +92,7 @@@ static struct kmem_cache *skbuff_fclone
  static struct kmem_cache *skbuff_ext_cache __ro_after_init;
  #endif
  
 -/* skb_small_head_cache and related code is only supported
 - * for CONFIG_SLAB and CONFIG_SLUB.
 - * As soon as SLOB is removed from the kernel, we can clean up this.
 - */
 -#if !defined(CONFIG_SLOB)
 -# define HAVE_SKB_SMALL_HEAD_CACHE 1
 -#endif
  
 -#ifdef HAVE_SKB_SMALL_HEAD_CACHE
  static struct kmem_cache *skb_small_head_cache __ro_after_init;
  
  #define SKB_SMALL_HEAD_SIZE SKB_HEAD_ALIGN(MAX_TCP_HEADER)
  
  #define SKB_SMALL_HEAD_HEADROOM                                               \
        SKB_WITH_OVERHEAD(SKB_SMALL_HEAD_CACHE_SIZE)
 -#endif /* HAVE_SKB_SMALL_HEAD_CACHE */
  
  int sysctl_max_skb_frags __read_mostly = MAX_SKB_FRAGS;
  EXPORT_SYMBOL(sysctl_max_skb_frags);
@@@ -553,6 -562,7 +553,6 @@@ static void *kmalloc_reserve(unsigned i
        void *obj;
  
        obj_size = SKB_HEAD_ALIGN(*size);
 -#ifdef HAVE_SKB_SMALL_HEAD_CACHE
        if (obj_size <= SKB_SMALL_HEAD_CACHE_SIZE &&
            !(flags & KMALLOC_NOT_NORMAL_BITS)) {
                obj = kmem_cache_alloc_node(skb_small_head_cache,
                obj = kmem_cache_alloc_node(skb_small_head_cache, flags, node);
                goto out;
        }
 -#endif
        *size = obj_size = kmalloc_size_roundup(obj_size);
        /*
         * Try a regular allocation, when that fails and we're not entitled
@@@ -887,9 -898,11 +887,9 @@@ static bool skb_pp_recycle(struct sk_bu
  
  static void skb_kfree_head(void *head, unsigned int end_offset)
  {
 -#ifdef HAVE_SKB_SMALL_HEAD_CACHE
        if (end_offset == SKB_SMALL_HEAD_HEADROOM)
                kmem_cache_free(skb_small_head_cache, head);
        else
 -#endif
                kfree(head);
  }
  
@@@ -2147,6 -2160,7 +2147,6 @@@ int __skb_unclone_keeptruesize(struct s
        if (likely(skb_end_offset(skb) == saved_end_offset))
                return 0;
  
 -#ifdef HAVE_SKB_SMALL_HEAD_CACHE
        /* We can not change skb->end if the original or new value
         * is SKB_SMALL_HEAD_HEADROOM, as it might break skb_kfree_head().
         */
                WARN_ON_ONCE(1);
                return 0;
        }
 -#endif
  
        shinfo = skb_shinfo(skb);
  
@@@ -4753,6 -4768,7 +4753,6 @@@ void __init skb_init(void
                                                0,
                                                SLAB_HWCACHE_ALIGN|SLAB_PANIC,
                                                NULL);
 -#ifdef HAVE_SKB_SMALL_HEAD_CACHE
        /* usercopy should only access first SKB_SMALL_HEAD_HEADROOM bytes.
         * struct skb_shared_info is located at the end of skb->head,
         * and should not be copied to/from user.
                                                0,
                                                SKB_SMALL_HEAD_HEADROOM,
                                                NULL);
 -#endif
        skb_extensions_init();
  }
  
@@@ -5281,7 -5298,7 +5281,7 @@@ bool skb_partial_csum_set(struct sk_buf
        u32 csum_end = (u32)start + (u32)off + sizeof(__sum16);
        u32 csum_start = skb_headroom(skb) + (u32)start;
  
-       if (unlikely(csum_start > U16_MAX || csum_end > skb_headlen(skb))) {
+       if (unlikely(csum_start >= U16_MAX || csum_end > skb_headlen(skb))) {
                net_warn_ratelimited("bad partial csum: csum=%u/%u headroom=%u headlen=%u\n",
                                     start, off, skb_headroom(skb), skb_headlen(skb));
                return false;
        skb->ip_summed = CHECKSUM_PARTIAL;
        skb->csum_start = csum_start;
        skb->csum_offset = off;
-       skb_set_transport_header(skb, start);
+       skb->transport_header = csum_start;
        return true;
  }
  EXPORT_SYMBOL_GPL(skb_partial_csum_set);