Skip to content
Permalink
Vinicius-Costa…
Switch branches/tags

Commits on Nov 10, 2021

  1. bpf: Fix build when CONFIG_BPF_SYSCALL is disabled

    When CONFIG_DEBUG_INFO_BTF is enabled and CONFIG_BPF_SYSCALL is
    disabled, the following compilation error can be seen:
    
      GEN     .version
      CHK     include/generated/compile.h
      UPD     include/generated/compile.h
      CC      init/version.o
      AR      init/built-in.a
      LD      vmlinux.o
      MODPOST vmlinux.symvers
      MODINFO modules.builtin.modinfo
      GEN     modules.builtin
      LD      .tmp_vmlinux.btf
    ld: net/ipv4/tcp_cubic.o: in function `cubictcp_unregister':
    net/ipv4/tcp_cubic.c:545: undefined reference to `bpf_tcp_ca_kfunc_list'
    ld: net/ipv4/tcp_cubic.c:545: undefined reference to `unregister_kfunc_btf_id_set'
    ld: net/ipv4/tcp_cubic.o: in function `cubictcp_register':
    net/ipv4/tcp_cubic.c:539: undefined reference to `bpf_tcp_ca_kfunc_list'
    ld: net/ipv4/tcp_cubic.c:539: undefined reference to `register_kfunc_btf_id_set'
      BTF     .btf.vmlinux.bin.o
    pahole: .tmp_vmlinux.btf: No such file or directory
      LD      .tmp_vmlinux.kallsyms1
    .btf.vmlinux.bin.o: file not recognized: file format not recognized
    make: *** [Makefile:1187: vmlinux] Error 1
    
    'bpf_tcp_ca_kfunc_list', 'register_kfunc_btf_id_set()' and
    'unregister_kfunc_btf_id_set()' are only defined when
    CONFIG_BPF_SYSCALL is enabled.
    
    Fix that by moving those definitions somewhere that doesn't depend on
    the bpf() syscall.
    
    Fixes: 14f267d ("bpf: btf: Introduce helpers for dynamic BTF set registration")
    Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
    vcgomes authored and intel-lab-lkp committed Nov 10, 2021

Commits on Nov 9, 2021

  1. Merge https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf

    Alexei Starovoitov says:
    
    ====================
    pull-request: bpf 2021-11-09
    
    We've added 7 non-merge commits during the last 3 day(s) which contain
    a total of 10 files changed, 174 insertions(+), 48 deletions(-).
    
    The main changes are:
    
    1) Various sockmap fixes, from John and Jussi.
    
    2) Fix out-of-bound issue with bpf_pseudo_func, from Martin.
    
    * https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf:
      bpf, sockmap: sk_skb data_end access incorrect when src_reg = dst_reg
      bpf: sockmap, strparser, and tls are reusing qdisc_skb_cb and colliding
      bpf, sockmap: Fix race in ingress receive verdict with redirect to self
      bpf, sockmap: Remove unhash handler for BPF sockmap usage
      bpf, sockmap: Use stricter sk state checks in sk_lookup_assign
      bpf: selftest: Trigger a DCE on the whole subprog
      bpf: Stop caching subprog index in the bpf_pseudo_func insn
    ====================
    
    Link: https://lore.kernel.org/r/20211109215702.38350-1-alexei.starovoitov@gmail.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Jakub Kicinski committed Nov 9, 2021
  2. amt: add IPV6 Kconfig dependency

    This driver cannot be built-in if IPV6 is a loadable module:
    
    x86_64-linux-ld: drivers/net/amt.o: in function `amt_build_mld_gq':
    amt.c:(.text+0x2e7d): undefined reference to `ipv6_dev_get_saddr'
    
    Add the idiomatic Kconfig dependency that all such modules
    have.
    
    Fixes: b9022b5 ("amt: add control plane of amt interface")
    Signed-off-by: Arnd Bergmann <arnd@arndb.de>
    Acked-by: Taehee Yoo <ap420073@gmail.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    arndb authored and davem330 committed Nov 9, 2021
  3. gve: Fix off by one in gve_tx_timeout()

    The priv->ntfy_blocks[] has "priv->num_ntfy_blks" elements so this >
    needs to be >= to prevent an off by one bug.  The priv->ntfy_blocks[]
    array is allocated in gve_alloc_notify_blocks().
    
    Fixes: 87a7f32 ("gve: Recover from queue stall due to missed IRQ")
    Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    error27 authored and davem330 committed Nov 9, 2021
  4. hamradio: defer 6pack kfree after unregister_netdev

    There is a possible race condition (use-after-free) like below
    
     (USE)                       |  (FREE)
      dev_queue_xmit             |
       __dev_queue_xmit          |
        __dev_xmit_skb           |
         sch_direct_xmit         | ...
          xmit_one               |
           netdev_start_xmit     | tty_ldisc_kill
            __netdev_start_xmit  |  6pack_close
             sp_xmit             |   kfree
              sp_encaps          |
                                 |
    
    According to the patch "defer ax25 kfree after unregister_netdev", this
    patch reorder the kfree after the unregister_netdev to avoid the possible
    UAF as the unregister_netdev() is well synchronized and won't return if
    there is a running routine.
    
    Signed-off-by: Lin Ma <linma@zju.edu.cn>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    f0rm2l1n authored and davem330 committed Nov 9, 2021
  5. hamradio: defer ax25 kfree after unregister_netdev

    There is a possible race condition (use-after-free) like below
    
     (USE)                       |  (FREE)
    ax25_sendmsg                 |
     ax25_queue_xmit             |
      dev_queue_xmit             |
       __dev_queue_xmit          |
        __dev_xmit_skb           |
         sch_direct_xmit         | ...
          xmit_one               |
           netdev_start_xmit     | tty_ldisc_kill
            __netdev_start_xmit  |  mkiss_close
             ax_xmit             |   kfree
              ax_encaps          |
                                 |
    
    Even though there are two synchronization primitives before the kfree:
    1. wait_for_completion(&ax->dead). This can prevent the race with
    routines from mkiss_ioctl. However, it cannot stop the routine coming
    from upper layer, i.e., the ax25_sendmsg.
    
    2. netif_stop_queue(ax->dev). It seems that this line of code aims to
    halt the transmit queue but it fails to stop the routine that already
    being xmit.
    
    This patch reorder the kfree after the unregister_netdev to avoid the
    possible UAF as the unregister_netdev() is well synchronized and won't
    return if there is a running routine.
    
    Signed-off-by: Lin Ma <linma@zju.edu.cn>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    f0rm2l1n authored and davem330 committed Nov 9, 2021
  6. net: sungem_phy: fix code indentation

    Remove extra space in front of the return statement.
    
    Fixes: eb5b5b2 ("sungem_phy: support bcm5461 phy, autoneg.")
    Signed-off-by: Jean Sacren <sakiwit@gmail.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    sacren authored and davem330 committed Nov 9, 2021
  7. bpf, sockmap: sk_skb data_end access incorrect when src_reg = dst_reg

    The current conversion of skb->data_end reads like this:
    
      ; data_end = (void*)(long)skb->data_end;
       559: (79) r1 = *(u64 *)(r2 +200)   ; r1  = skb->data
       560: (61) r11 = *(u32 *)(r2 +112)  ; r11 = skb->len
       561: (0f) r1 += r11
       562: (61) r11 = *(u32 *)(r2 +116)
       563: (1f) r1 -= r11
    
    But similar to the case in 84f44df ("bpf: sock_ops sk access may stomp
    registers when dst_reg = src_reg"), the code will read an incorrect skb->len
    when src == dst. In this case we end up generating this xlated code:
    
      ; data_end = (void*)(long)skb->data_end;
       559: (79) r1 = *(u64 *)(r1 +200)   ; r1  = skb->data
       560: (61) r11 = *(u32 *)(r1 +112)  ; r11 = (skb->data)->len
       561: (0f) r1 += r11
       562: (61) r11 = *(u32 *)(r1 +116)
       563: (1f) r1 -= r11
    
    ... where line 560 is the reading 4B of (skb->data + 112) instead of the
    intended skb->len Here the skb pointer in r1 gets set to skb->data and the
    later deref for skb->len ends up following skb->data instead of skb.
    
    This fixes the issue similarly to the patch mentioned above by creating an
    additional temporary variable and using to store the register when dst_reg =
    src_reg. We name the variable bpf_temp_reg and place it in the cb context for
    sk_skb. Then we restore from the temp to ensure nothing is lost.
    
    Fixes: 16137b0 ("bpf: Compute data_end dynamically with JIT code")
    Signed-off-by: Jussi Maki <joamaki@gmail.com>
    Signed-off-by: John Fastabend <john.fastabend@gmail.com>
    Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
    Reviewed-by: Jakub Sitnicki <jakub@cloudflare.com>
    Link: https://lore.kernel.org/bpf/20211103204736.248403-6-john.fastabend@gmail.com
    joamaki authored and borkmann committed Nov 9, 2021
  8. bpf: sockmap, strparser, and tls are reusing qdisc_skb_cb and colliding

    Strparser is reusing the qdisc_skb_cb struct to stash the skb message handling
    progress, e.g. offset and length of the skb. First this is poorly named and
    inherits a struct from qdisc that doesn't reflect the actual usage of cb[] at
    this layer.
    
    But, more importantly strparser is using the following to access its metadata.
    
      (struct _strp_msg *)((void *)skb->cb + offsetof(struct qdisc_skb_cb, data))
    
    Where _strp_msg is defined as:
    
      struct _strp_msg {
            struct strp_msg            strp;                 /*     0     8 */
            int                        accum_len;            /*     8     4 */
    
            /* size: 12, cachelines: 1, members: 2 */
            /* last cacheline: 12 bytes */
      };
    
    So we use 12 bytes of ->data[] in struct. However in BPF code running parser
    and verdict the user has read capabilities into the data[] array as well. Its
    not too problematic, but we should not be exposing internal state to BPF
    program. If its really needed then we can use the probe_read() APIs which allow
    reading kernel memory. And I don't believe cb[] layer poses any API breakage by
    moving this around because programs can't depend on cb[] across layers.
    
    In order to fix another issue with a ctx rewrite we need to stash a temp
    variable somewhere. To make this work cleanly this patch builds a cb struct
    for sk_skb types called sk_skb_cb struct. Then we can use this consistently
    in the strparser, sockmap space. Additionally we can start allowing ->cb[]
    write access after this.
    
    Fixes: 604326b ("bpf, sockmap: convert to generic sk_msg interface")
    Signed-off-by: John Fastabend <john.fastabend@gmail.com>
    Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
    Tested-by: Jussi Maki <joamaki@gmail.com>
    Reviewed-by: Jakub Sitnicki <jakub@cloudflare.com>
    Link: https://lore.kernel.org/bpf/20211103204736.248403-5-john.fastabend@gmail.com
    jrfastab authored and borkmann committed Nov 9, 2021

Commits on Nov 8, 2021

  1. bpf, sockmap: Fix race in ingress receive verdict with redirect to self

    A socket in a sockmap may have different combinations of programs attached
    depending on configuration. There can be no programs in which case the socket
    acts as a sink only. There can be a TX program in this case a BPF program is
    attached to sending side, but no RX program is attached. There can be an RX
    program only where sends have no BPF program attached, but receives are hooked
    with BPF. And finally, both TX and RX programs may be attached. Giving us the
    permutations:
    
     None, Tx, Rx, and TxRx
    
    To date most of our use cases have been TX case being used as a fast datapath
    to directly copy between local application and a userspace proxy. Or Rx cases
    and TxRX applications that are operating an in kernel based proxy. The traffic
    in the first case where we hook applications into a userspace application looks
    like this:
    
      AppA  redirect   AppB
       Tx <-----------> Rx
       |                |
       +                +
       TCP <--> lo <--> TCP
    
    In this case all traffic from AppA (after 3whs) is copied into the AppB
    ingress queue and no traffic is ever on the TCP recieive_queue.
    
    In the second case the application never receives, except in some rare error
    cases, traffic on the actual user space socket. Instead the send happens in
    the kernel.
    
               AppProxy       socket pool
           sk0 ------------->{sk1,sk2, skn}
            ^                      |
            |                      |
            |                      v
           ingress              lb egress
           TCP                  TCP
    
    Here because traffic is never read off the socket with userspace recv() APIs
    there is only ever one reader on the sk receive_queue. Namely the BPF programs.
    
    However, we've started to introduce a third configuration where the BPF program
    on receive should process the data, but then the normal case is to push the
    data into the receive queue of AppB.
    
           AppB
           recv()                (userspace)
         -----------------------
           tcp_bpf_recvmsg()     (kernel)
             |             |
             |             |
             |             |
           ingress_msgQ    |
             |             |
           RX_BPF          |
             |             |
             v             v
           sk->receive_queue
    
    This is different from the App{A,B} redirect because traffic is first received
    on the sk->receive_queue.
    
    Now for the issue. The tcp_bpf_recvmsg() handler first checks the ingress_msg
    queue for any data handled by the BPF rx program and returned with PASS code
    so that it was enqueued on the ingress msg queue. Then if no data exists on
    that queue it checks the socket receive queue. Unfortunately, this is the same
    receive_queue the BPF program is reading data off of. So we get a race. Its
    possible for the recvmsg() hook to pull data off the receive_queue before the
    BPF hook has a chance to read it. It typically happens when an application is
    banging on recv() and getting EAGAINs. Until they manage to race with the RX
    BPF program.
    
    To fix this we note that before this patch at attach time when the socket is
    loaded into the map we check if it needs a TX program or just the base set of
    proto bpf hooks. Then it uses the above general RX hook regardless of if we
    have a BPF program attached at rx or not. This patch now extends this check to
    handle all cases enumerated above, TX, RX, TXRX, and none. And to fix above
    race when an RX program is attached we use a new hook that is nearly identical
    to the old one except now we do not let the recv() call skip the RX BPF program.
    Now only the BPF program pulls data from sk->receive_queue and recv() only
    pulls data from the ingress msgQ post BPF program handling.
    
    With this resolved our AppB from above has been up and running for many hours
    without detecting any errors. We do this by correlating counters in RX BPF
    events and the AppB to ensure data is never skipping the BPF program. Selftests,
    was not able to detect this because we only run them for a short period of time
    on well ordered send/recvs so we don't get any of the noise we see in real
    application environments.
    
    Fixes: 5119940 ("bpf: skb_verdict, support SK_PASS on RX BPF path")
    Signed-off-by: John Fastabend <john.fastabend@gmail.com>
    Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
    Tested-by: Jussi Maki <joamaki@gmail.com>
    Reviewed-by: Jakub Sitnicki <jakub@cloudflare.com>
    Link: https://lore.kernel.org/bpf/20211103204736.248403-4-john.fastabend@gmail.com
    jrfastab authored and borkmann committed Nov 8, 2021
  2. bpf, sockmap: Remove unhash handler for BPF sockmap usage

    We do not need to handle unhash from BPF side we can simply wait for the
    close to happen. The original concern was a socket could transition from
    ESTABLISHED state to a new state while the BPF hook was still attached.
    But, we convinced ourself this is no longer possible and we also improved
    BPF sockmap to handle listen sockets so this is no longer a problem.
    
    More importantly though there are cases where unhash is called when data is
    in the receive queue. The BPF unhash logic will flush this data which is
    wrong. To be correct it should keep the data in the receive queue and allow
    a receiving application to continue reading the data. This may happen when
    tcp_abort() is received for example. Instead of complicating the logic in
    unhash simply moving all this to tcp_close() hook solves this.
    
    Fixes: 5119940 ("bpf: skb_verdict, support SK_PASS on RX BPF path")
    Signed-off-by: John Fastabend <john.fastabend@gmail.com>
    Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
    Tested-by: Jussi Maki <joamaki@gmail.com>
    Reviewed-by: Jakub Sitnicki <jakub@cloudflare.com>
    Link: https://lore.kernel.org/bpf/20211103204736.248403-3-john.fastabend@gmail.com
    jrfastab authored and borkmann committed Nov 8, 2021
  3. bpf, sockmap: Use stricter sk state checks in sk_lookup_assign

    In order to fix an issue with sockets in TCP sockmap redirect cases we plan
    to allow CLOSE state sockets to exist in the sockmap. However, the check in
    bpf_sk_lookup_assign() currently only invalidates sockets in the
    TCP_ESTABLISHED case relying on the checks on sockmap insert to ensure we
    never SOCK_CLOSE state sockets in the map.
    
    To prepare for this change we flip the logic in bpf_sk_lookup_assign() to
    explicitly test for the accepted cases. Namely, a tcp socket in TCP_LISTEN
    or a udp socket in TCP_CLOSE state. This also makes the code more resilent
    to future changes.
    
    Suggested-by: Jakub Sitnicki <jakub@cloudflare.com>
    Signed-off-by: John Fastabend <john.fastabend@gmail.com>
    Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
    Reviewed-by: Jakub Sitnicki <jakub@cloudflare.com>
    Link: https://lore.kernel.org/bpf/20211103204736.248403-2-john.fastabend@gmail.com
    jrfastab authored and borkmann committed Nov 8, 2021

Commits on Nov 7, 2021

  1. litex_liteeth: Fix a double free in the remove function

    'netdev' is a managed resource allocated in the probe using
    'devm_alloc_etherdev()'.
    It must not be freed explicitly in the remove function.
    
    Fixes: ee7da21 ("net: Add driver for LiteX's LiteETH network interface")
    Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    tititiou36 authored and davem330 committed Nov 7, 2021
  2. nfc: pn533: Fix double free when pn533_fill_fragment_skbs() fails

    skb is already freed by dev_kfree_skb in pn533_fill_fragment_skbs,
    but follow error handler branch when pn533_fill_fragment_skbs()
    fails, skb is freed again, results in double free issue. Fix this
    by not free skb in error path of pn533_fill_fragment_skbs.
    
    Fixes: 963a82e ("NFC: pn533: Split large Tx frames in chunks")
    Fixes: 93ad420 ("NFC: pn533: Target mode Tx fragmentation support")
    Signed-off-by: Chengfeng Ye <cyeaa@connect.ust.hk>
    Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
    Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Chengfeng Ye authored and davem330 committed Nov 7, 2021
  3. selftests: net: tls: remove unused variable and code

    When building selftests/net with clang, the compiler warn about the
    function abs() see below:
    
    tls.c:657:15: warning: variable 'len_compared' set but not used [-Wunused-but-set-variable]
            unsigned int len_compared = 0;
                         ^
    
    Rework to remove the unused variable and the for-loop where the variable
    'len_compared' was assinged.
    
    Fixes: 7f657d5 ("selftests: tls: add selftests for TLS sockets")
    Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
    Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    roxell authored and davem330 committed Nov 7, 2021
  4. net: marvell: prestera: fix hw structure laid out

    The prestera FW v4.0 support commit has been merged
    accidentally w/o review comments addressed and waiting
    for the final patch set to be uploaded. So, fix the remaining
    comments related to structure laid out and build issues.
    
    Reported-by: kernel test robot <lkp@intel.com>
    Fixes: bb5dbf2 ("net: marvell: prestera: add firmware v4.0 support")
    Signed-off-by: Volodymyr Mytnyk <vmytnyk@marvell.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Volodymyr Mytnyk authored and davem330 committed Nov 7, 2021
  5. sctp: remove unreachable code from sctp_sf_violation_chunk()

    sctp_sf_violation_chunk() is not called with asoc argument equal to NULL,
    but if that happens it would lead to NULL pointer dereference
    in sctp_vtag_verify().
    
    The patch removes code that handles NULL asoc in sctp_sf_violation_chunk().
    
    Found by Linux Verification Center (linuxtesting.org) with SVACE.
    
    Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
    Proposed-by: Xin Long <lucien.xin@gmail.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    khoroshilov authored and davem330 committed Nov 7, 2021
  6. llc: fix out-of-bound array index in llc_sk_dev_hash()

    Both ifindex and LLC_SK_DEV_HASH_ENTRIES are signed.
    
    This means that (ifindex % LLC_SK_DEV_HASH_ENTRIES) is negative
    if @ifindex is negative.
    
    We could simply make LLC_SK_DEV_HASH_ENTRIES unsigned.
    
    In this patch I chose to use hash_32() to get more entropy
    from @ifindex, like llc_sk_laddr_hashfn().
    
    UBSAN: array-index-out-of-bounds in ./include/net/llc.h:75:26
    index -43 is out of range for type 'hlist_head [64]'
    CPU: 1 PID: 20999 Comm: syz-executor.3 Not tainted 5.15.0-syzkaller #0
    Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
    Call Trace:
     <TASK>
     __dump_stack lib/dump_stack.c:88 [inline]
     dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106
     ubsan_epilogue+0xb/0x5a lib/ubsan.c:151
     __ubsan_handle_out_of_bounds.cold+0x62/0x6c lib/ubsan.c:291
     llc_sk_dev_hash include/net/llc.h:75 [inline]
     llc_sap_add_socket+0x49c/0x520 net/llc/llc_conn.c:697
     llc_ui_bind+0x680/0xd70 net/llc/af_llc.c:404
     __sys_bind+0x1e9/0x250 net/socket.c:1693
     __do_sys_bind net/socket.c:1704 [inline]
     __se_sys_bind net/socket.c:1702 [inline]
     __x64_sys_bind+0x6f/0xb0 net/socket.c:1702
     do_syscall_x64 arch/x86/entry/common.c:50 [inline]
     do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
     entry_SYSCALL_64_after_hwframe+0x44/0xae
    RIP: 0033:0x7fa503407ae9
    
    Fixes: 6d2e3ea ("llc: use a device based hash table to speed up multicast delivery")
    Signed-off-by: Eric Dumazet <edumazet@google.com>
    Reported-by: syzbot <syzkaller@googlegroups.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    neebe000 authored and davem330 committed Nov 7, 2021
  7. net: hisilicon: fix hsn3_ethtool kernel-doc warnings

    Fix kernel-doc warnings and spacing in hns3_ethtool.c:
    
    hns3_ethtool.c:246: warning: No description found for return value of 'hns3_lp_run_test'
    hns3_ethtool.c:408: warning: expecting prototype for hns3_nic_self_test(). Prototype was for hns3_self_test() instead
    
    Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
    Reported-by: kernel test robot <lkp@intel.com>
    Cc: Peng Li <lipeng321@huawei.com>
    Cc: Guangbin Huang <huangguangbin2@huawei.com>
    Cc: Yisen Zhuang <yisen.zhuang@huawei.com>
    Cc: Salil Mehta <salil.mehta@huawei.com>
    Cc: "David S. Miller" <davem@davemloft.net>
    Cc: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    rddunlap authored and davem330 committed Nov 7, 2021
  8. nfc: port100: lower verbosity of cancelled URB messages

    It is not an error to receive an URB with -ENOENT because it can come
    from regular user operations, e.g. pressing CTRL+C when running nfctool
    from neard.  Make it a debugging message, not an error.
    
    Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    krzk authored and davem330 committed Nov 7, 2021
  9. Merge tag 'linux-can-fixes-for-5.16-20211106' of git://git.kernel.org…

    …/pub/scm/linux/kernel/git/mkl/linux-can
    
    linux-can-fixes-for-5.16-20211106
    
    Marc Kleine-Budde says:
    
    ====================
    pull-request: can 2021-11-06
    
    this is a pull request of 8 patches for net/master.
    
    The first 3 patches are by Zhang Changzhong and fix 3 standard
    conformance problems in the j1939 CAN stack.
    
    The next patch is by Vincent Mailhol and fixes a memory leak in the
    leak error path of the etas_es58x CAN driver.
    
    Stephane Grosjean contributes 2 patches for the peak_usb driver to fix
    the bus error handling and update the order of printed information
    regarding firmware version and available updates.
    
    The last 2 patches are by me and fixes a packet starvation problem in
    the bus off case and the error handling in the mcp251xfd_chip_start()
    function.
    ====================
    
    Signed-off-by: David S. Miller <davem@davemloft.net>
    davem330 committed Nov 7, 2021

Commits on Nov 6, 2021

  1. can: mcp251xfd: mcp251xfd_chip_start(): fix error handling for mcp251…

    …xfd_chip_rx_int_enable()
    
    This patch fixes the error handling for mcp251xfd_chip_rx_int_enable().
    Instead just returning the error, properly shut down the chip.
    
    Link: https://lore.kernel.org/all/20211106201526.44292-2-mkl@pengutronix.de
    Fixes: 55e5b97 ("can: mcp25xxfd: add driver for Microchip MCP25xxFD SPI CAN")
    Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
    marckleinebudde committed Nov 6, 2021
  2. Merge branch 'bpf: Fix out-of-bound issue when jit-ing bpf_pseudo_func'

    Martin KaFai says:
    
    ====================
    
    This set fixes an out-of-bound access issue when jit-ing the
    bpf_pseudo_func insn (i.e. ld_imm64 with src_reg == BPF_PSEUDO_FUNC)
    ====================
    
    Reported-by: Yonatan Komornik <yoniko@gmail.com>
    Signed-off-by: Alexei Starovoitov <ast@kernel.org>
    Alexei Starovoitov committed Nov 6, 2021
  3. can: mcp251xfd: mcp251xfd_irq(): add missing can_rx_offload_threaded_…

    …irq_finish() in case of bus off
    
    The function can_rx_offload_threaded_irq_finish() is needed to trigger
    the NAPI thread to deliver read CAN frames to the networking stack.
    
    This patch adds the missing call to can_rx_offload_threaded_irq_finish()
    in case of a bus off, before leaving the interrupt handler to avoid
    packet starvation.
    
    Link: https://lore.kernel.org/all/20211106201526.44292-1-mkl@pengutronix.de
    Fixes: 30bfec4 ("can: rx-offload: can_rx_offload_threaded_irq_finish(): add new function to be called from threaded interrupt")
    Cc: stable@vger.kernel.org
    Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
    marckleinebudde committed Nov 6, 2021
  4. bpf: selftest: Trigger a DCE on the whole subprog

    This patch adds a test to trigger the DCE to remove
    the whole subprog to ensure the verifier  does not
    depend on a stable subprog index.  The DCE is done
    by testing a global const.
    
    Signed-off-by: Martin KaFai Lau <kafai@fb.com>
    Signed-off-by: Alexei Starovoitov <ast@kernel.org>
    Link: https://lore.kernel.org/bpf/20211106014020.651638-1-kafai@fb.com
    iamkafai authored and Alexei Starovoitov committed Nov 6, 2021
  5. bpf: Stop caching subprog index in the bpf_pseudo_func insn

    This patch is to fix an out-of-bound access issue when jit-ing the
    bpf_pseudo_func insn (i.e. ld_imm64 with src_reg == BPF_PSEUDO_FUNC)
    
    In jit_subprog(), it currently reuses the subprog index cached in
    insn[1].imm.  This subprog index is an index into a few array related
    to subprogs.  For example, in jit_subprog(), it is an index to the newly
    allocated 'struct bpf_prog **func' array.
    
    The subprog index was cached in insn[1].imm after add_subprog().  However,
    this could become outdated (and too big in this case) if some subprogs
    are completely removed during dead code elimination (in
    adjust_subprog_starts_after_remove).  The cached index in insn[1].imm
    is not updated accordingly and causing out-of-bound issue in the later
    jit_subprog().
    
    Unlike bpf_pseudo_'func' insn, the current bpf_pseudo_'call' insn
    is handling the DCE properly by calling find_subprog(insn->imm) to
    figure out the index instead of caching the subprog index.
    The existing bpf_adj_branches() will adjust the insn->imm
    whenever insn is added or removed.
    
    Instead of having two ways handling subprog index,
    this patch is to make bpf_pseudo_func works more like
    bpf_pseudo_call.
    
    First change is to stop caching the subprog index result
    in insn[1].imm after add_subprog().  The verification
    process will use find_subprog(insn->imm) to figure
    out the subprog index.
    
    Second change is in bpf_adj_branches() and have it to
    adjust the insn->imm for the bpf_pseudo_func insn also
    whenever insn is added or removed.
    
    Third change is in jit_subprog().  Like the bpf_pseudo_call handling,
    bpf_pseudo_func temporarily stores the find_subprog() result
    in insn->off.  It is fine because the prog's insn has been finalized
    at this point.  insn->off will be reset back to 0 later to avoid
    confusing the userspace prog dump tool.
    
    Fixes: 69c087b ("bpf: Add bpf_for_each_map_elem() helper")
    Signed-off-by: Martin KaFai Lau <kafai@fb.com>
    Signed-off-by: Alexei Starovoitov <ast@kernel.org>
    Link: https://lore.kernel.org/bpf/20211106014014.651018-1-kafai@fb.com
    iamkafai authored and Alexei Starovoitov committed Nov 6, 2021
  6. can: peak_usb: exchange the order of information messages

    Proposes the possible update of the PCAN-USB firmware after indicating its
    name and current version.
    
    Link: https://lore.kernel.org/all/20211021081505.18223-3-s.grosjean@peak-system.com
    Signed-off-by: Stephane Grosjean <s.grosjean@peak-system.com>
    Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
    Stephane Grosjean authored and marckleinebudde committed Nov 6, 2021
  7. can: peak_usb: always ask for BERR reporting for PCAN-USB devices

    Since for the PCAN-USB, the management of the transition to the
    ERROR_WARNING or ERROR_PASSIVE state is done according to the error
    counters, these must be requested unconditionally.
    
    Link: https://lore.kernel.org/all/20211021081505.18223-2-s.grosjean@peak-system.com
    Fixes: c11dcee ("can: peak_usb: pcan_usb_decode_error(): upgrade handling of bus state changes")
    Cc: stable@vger.kernel.org
    Signed-off-by: Stephane Grosjean <s.grosjean@peak-system.com>
    Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
    Stephane Grosjean authored and marckleinebudde committed Nov 6, 2021
  8. can: etas_es58x: es58x_rx_err_msg(): fix memory leak in error path

    In es58x_rx_err_msg(), if can->do_set_mode() fails, the function
    directly returns without calling netif_rx(skb). This means that the
    skb previously allocated by alloc_can_err_skb() is not freed. In other
    terms, this is a memory leak.
    
    This patch simply removes the return statement in the error branch and
    let the function continue.
    
    Issue was found with GCC -fanalyzer, please follow the link below for
    details.
    
    Fixes: 8537257 ("can: etas_es58x: add core support for ETAS ES58X CAN USB interfaces")
    Link: https://lore.kernel.org/all/20211026180740.1953265-1-mailhol.vincent@wanadoo.fr
    Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
    Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
    vincent-mailhol authored and marckleinebudde committed Nov 6, 2021
  9. can: j1939: j1939_tp_cmd_recv(): check the dst address of TP.CM_BAM

    The TP.CM_BAM message must be sent to the global address [1], so add a
    check to drop TP.CM_BAM sent to a non-global address.
    
    Without this patch, the receiver will treat the following packets as
    normal RTS/CTS transport:
    18EC0102#20090002FF002301
    18EB0102#0100000000000000
    18EB0102#020000FFFFFFFFFF
    
    [1] SAE-J1939-82 2015 A.3.3 Row 1.
    
    Fixes: 9d71dd0 ("can: add support of SAE J1939 protocol")
    Link: https://lore.kernel.org/all/1635431907-15617-4-git-send-email-zhangchangzhong@huawei.com
    Cc: stable@vger.kernel.org
    Signed-off-by: Zhang Changzhong <zhangchangzhong@huawei.com>
    Acked-by: Oleksij Rempel <o.rempel@pengutronix.de>
    Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
    Zhang Changzhong authored and marckleinebudde committed Nov 6, 2021
  10. can: j1939: j1939_can_recv(): ignore messages with invalid source add…

    …ress
    
    According to SAE-J1939-82 2015 (A.3.6 Row 2), a receiver should never
    send TP.CM_CTS to the global address, so we can add a check in
    j1939_can_recv() to drop messages with invalid source address.
    
    Fixes: 9d71dd0 ("can: add support of SAE J1939 protocol")
    Link: https://lore.kernel.org/all/1635431907-15617-3-git-send-email-zhangchangzhong@huawei.com
    Cc: stable@vger.kernel.org
    Signed-off-by: Zhang Changzhong <zhangchangzhong@huawei.com>
    Acked-by: Oleksij Rempel <o.rempel@pengutronix.de>
    Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
    Zhang Changzhong authored and marckleinebudde committed Nov 6, 2021
  11. can: j1939: j1939_tp_cmd_recv(): ignore abort message in the BAM tran…

    …sport
    
    This patch prevents BAM transport from being closed by receiving abort
    message, as specified in SAE-J1939-82 2015 (A.3.3 Row 4).
    
    Fixes: 9d71dd0 ("can: add support of SAE J1939 protocol")
    Link: https://lore.kernel.org/all/1635431907-15617-2-git-send-email-zhangchangzhong@huawei.com
    Cc: stable@vger.kernel.org
    Signed-off-by: Zhang Changzhong <zhangchangzhong@huawei.com>
    Acked-by: Oleksij Rempel <o.rempel@pengutronix.de>
    Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
    Zhang Changzhong authored and marckleinebudde committed Nov 6, 2021
  12. ipv6: remove useless assignment to newinet in tcp_v6_syn_recv_sock()

    The newinet value is initialized with inet_sk() in a block code to
    handle sockets for the ETH_P_IP protocol. Along this code path,
    newinet is never read. Thus, assignment to newinet is needless and
    can be removed.
    
    Signed-off-by: Nghia Le <nghialm78@gmail.com>
    Reviewed-by: Eric Dumazet <edumazet@google.com>
    Link: https://lore.kernel.org/r/20211104143740.32446-1-nghialm78@gmail.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Nghia Le authored and Jakub Kicinski committed Nov 6, 2021

Commits on Nov 5, 2021

  1. Merge https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf

    Daniel Borkmann says:
    
    ====================
    pull-request: bpf 2021-11-05
    
    We've added 15 non-merge commits during the last 3 day(s) which contain
    a total of 14 files changed, 199 insertions(+), 90 deletions(-).
    
    The main changes are:
    
    1) Fix regression from stack spill/fill of <8 byte scalars, from Martin KaFai Lau.
    
    2) Fix perf's build of bpftool's bootstrap version due to missing libbpf
       headers, from Quentin Monnet.
    
    3) Fix riscv{32,64} BPF exception tables build errors and warnings, from Björn Töpel.
    
    4) Fix bpf fs to allow RENAME_EXCHANGE support for atomic upgrades on sk_lookup
       control planes, from Lorenz Bauer.
    
    5) Fix libbpf's error reporting in bpf_map_lookup_and_delete_elem_flags() due to
       missing libbpf_err_errno(), from Mehrdad Arshad Rad.
    
    6) Various fixes to make xdp_redirect_multi selftest more reliable, from Hangbin Liu.
    
    7) Fix netcnt selftest to make it run serial and thus avoid conflicts with other
       cgroup/skb selftests run in parallel that could cause flakes, from Andrii Nakryiko.
    
    8) Fix reuseport_bpf_numa networking selftest to skip unavailable NUMA nodes,
       from Kleber Sacilotto de Souza.
    
    * https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf:
      riscv, bpf: Fix RV32 broken build, and silence RV64 warning
      selftests/bpf/xdp_redirect_multi: Limit the tests in netns
      selftests/bpf/xdp_redirect_multi: Give tcpdump a chance to terminate cleanly
      selftests/bpf/xdp_redirect_multi: Use arping to accurate the arp number
      selftests/bpf/xdp_redirect_multi: Put the logs to tmp folder
      libbpf: Fix lookup_and_delete_elem_flags error reporting
      bpftool: Install libbpf headers for the bootstrap version, too
      selftests/net: Fix reuseport_bpf_numa by skipping unavailable nodes
      selftests/bpf: Verifier test on refill from a smaller spill
      bpf: Do not reject when the stack read size is different from the tracked scalar size
      selftests/bpf: Make netcnt selftests serial to avoid spurious failures
      selftests/bpf: Test RENAME_EXCHANGE and RENAME_NOREPLACE on bpffs
      selftests/bpf: Convert test_bpffs to ASSERT macros
      libfs: Support RENAME_EXCHANGE in simple_rename()
      libfs: Move shmem_exchange to simple_rename_exchange
    ====================
    
    Link: https://lore.kernel.org/r/20211105165803.29372-1-daniel@iogearbox.net
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Jakub Kicinski committed Nov 5, 2021
  2. riscv, bpf: Fix RV32 broken build, and silence RV64 warning

    Commit 252c765 ("riscv, bpf: Add BPF exception tables") only addressed
    RV64, and broke the RV32 build [1]. Fix by gating the exception tables code
    with CONFIG_ARCH_RV64I.
    
    Further, silence a "-Wmissing-prototypes" warning [2] in the RV64 BPF JIT.
    
      [1] https://lore.kernel.org/llvm/202111020610.9oy9Rr0G-lkp@intel.com/
      [2] https://lore.kernel.org/llvm/202110290334.2zdMyRq4-lkp@intel.com/
    
    Fixes: 252c765 ("riscv, bpf: Add BPF exception tables")
    Signed-off-by: Björn Töpel <bjorn@kernel.org>
    Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
    Reviewed-by: Tong Tiangen <tongtiangen@huawei.com>
    Link: https://lore.kernel.org/bpf/20211103115453.397209-1-bjorn@kernel.org
    Björn Töpel authored and borkmann committed Nov 5, 2021
Older