1. 08 1月, 2021 24 次提交
  2. 07 1月, 2021 11 次提交
  3. 06 1月, 2021 5 次提交
    • J
      tools/resolve_btfids: Warn when having multiple IDs for single type · 67208692
      Jiri Olsa 提交于
      The kernel image can contain multiple types (structs/unions)
      with the same name. This causes distinct type hierarchies in
      BTF data and makes resolve_btfids fail with error like:
      
        BTFIDS  vmlinux
      FAILED unresolved symbol udp6_sock
      
      as reported by Qais Yousef [1].
      
      This change adds warning when multiple types of the same name
      are detected:
      
        BTFIDS  vmlinux
      WARN: multiple IDs found for 'file': 526, 113351 - using 526
      WARN: multiple IDs found for 'sk_buff': 2744, 113958 - using 2744
      
      We keep the lower ID for the given type instance and let the
      build continue.
      
      Also changing the 'nr' variable name to 'nr_types' to avoid confusion.
      
      [1] https://lore.kernel.org/lkml/20201229151352.6hzmjvu3qh6p2qgg@e107158-lin/Signed-off-by: NJiri Olsa <jolsa@kernel.org>
      Signed-off-by: NAlexei Starovoitov <ast@kernel.org>
      Acked-by: NAndrii Nakryiko <andrii@kernel.org>
      Link: https://lore.kernel.org/bpf/20210105234219.970039-1-jolsa@kernel.org
      67208692
    • P
      selftests: fix the return value for UDP GRO test · 3503ee6c
      Po-Hsu Lin 提交于
      The udpgro.sh will always return 0 (unless the bpf selftest was not
      build first) even if there are some failed sub test-cases.
      
      Therefore the kselftest framework will report this case is OK.
      
      Check and return the exit status of each test to make it easier to
      spot real failures.
      Signed-off-by: NPo-Hsu Lin <po-hsu.lin@canonical.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      3503ee6c
    • M
      net: ethernet: fs_enet: Add missing MODULE_LICENSE · 445c6198
      Michael Ellerman 提交于
      Since commit 1d6cd392 ("modpost: turn missing MODULE_LICENSE()
      into error") the ppc32_allmodconfig build fails with:
      
        ERROR: modpost: missing MODULE_LICENSE() in drivers/net/ethernet/freescale/fs_enet/mii-fec.o
        ERROR: modpost: missing MODULE_LICENSE() in drivers/net/ethernet/freescale/fs_enet/mii-bitbang.o
      
      Add the missing MODULE_LICENSEs to fix the build. Both files include a
      copyright header indicating they are GPL v2.
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      Reviewed-by: NAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      445c6198
    • Q
      net: qrtr: fix null-ptr-deref in qrtr_ns_remove · 4beb17e5
      Qinglang Miao 提交于
      A null-ptr-deref bug is reported by Hulk Robot like this:
      --------------
      KASAN: null-ptr-deref in range [0x0000000000000128-0x000000000000012f]
      Call Trace:
      qrtr_ns_remove+0x22/0x40 [ns]
      qrtr_proto_fini+0xa/0x31 [qrtr]
      __x64_sys_delete_module+0x337/0x4e0
      do_syscall_64+0x34/0x80
      entry_SYSCALL_64_after_hwframe+0x44/0xa9
      RIP: 0033:0x468ded
      --------------
      
      When qrtr_ns_init fails in qrtr_proto_init, qrtr_ns_remove which would
      be called later on would raise a null-ptr-deref because qrtr_ns.workqueue
      has been destroyed.
      
      Fix it by making qrtr_ns_init have a return value and adding a check in
      qrtr_proto_init.
      Reported-by: NHulk Robot <hulkci@huawei.com>
      Signed-off-by: NQinglang Miao <miaoqinglang@huawei.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      4beb17e5
    • J
      net: cdc_ncm: correct overhead in delayed_ndp_size · 7a68d725
      Jouni K. Seppänen 提交于
      Aligning to tx_ndp_modulus is not sufficient because the next align
      call can be cdc_ncm_align_tail, which can add up to ctx->tx_modulus +
      ctx->tx_remainder - 1 bytes. This used to lead to occasional crashes
      on a Huawei 909s-120 LTE module as follows:
      
      - the condition marked /* if there is a remaining skb [...] */ is true
        so the swaps happen
      - skb_out is set from ctx->tx_curr_skb
      - skb_out->len is exactly 0x3f52
      - ctx->tx_curr_size is 0x4000 and delayed_ndp_size is 0xac
        (note that the sum of skb_out->len and delayed_ndp_size is 0x3ffe)
      - the for loop over n is executed once
      - the cdc_ncm_align_tail call marked /* align beginning of next frame */
        increases skb_out->len to 0x3f56 (the sum is now 0x4002)
      - the condition marked /* check if we had enough room left [...] */ is
        false so we break out of the loop
      - the condition marked /* If requested, put NDP at end of frame. */ is
        true so the NDP is written into skb_out
      - now skb_out->len is 0x4002, so padding_count is minus two interpreted
        as an unsigned number, which is used as the length argument to memset,
        leading to a crash with various symptoms but usually including
      
      > Call Trace:
      >  <IRQ>
      >  cdc_ncm_fill_tx_frame+0x83a/0x970 [cdc_ncm]
      >  cdc_mbim_tx_fixup+0x1d9/0x240 [cdc_mbim]
      >  usbnet_start_xmit+0x5d/0x720 [usbnet]
      
      The cdc_ncm_align_tail call first aligns on a ctx->tx_modulus
      boundary (adding at most ctx->tx_modulus-1 bytes), then adds
      ctx->tx_remainder bytes. Alternatively, the next alignment call can
      occur in cdc_ncm_ndp16 or cdc_ncm_ndp32, in which case at most
      ctx->tx_ndp_modulus-1 bytes are added.
      
      A similar problem has occurred before, and the code is nontrivial to
      reason about, so add a guard before the crashing call. By that time it
      is too late to prevent any memory corruption (we'll have written past
      the end of the buffer already) but we can at least try to get a warning
      written into an on-disk log by avoiding the hard crash caused by padding
      past the buffer with a huge number of zeros.
      Signed-off-by: NJouni K. Seppänen <jks@iki.fi>
      Fixes: 4a0e3e98 ("cdc_ncm: Add support for moving NDP to end of NCM frame")
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=209407Reported-by: Nkernel test robot <lkp@intel.com>
      Reviewed-by: NBjørn Mork <bjorn@mork.no>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      7a68d725