1. 04 11月, 2022 7 次提交
    • J
      Merge tag 'wireless-2022-11-03' of git://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless · 91018bbc
      Jakub Kicinski 提交于
      Kalle Valo says:
      
      ====================
      wireless fixes for v6.1
      
      Second set of fixes for v6.1. Some fixes to char type usage in
      drivers, memory leaks in the stack and also functionality fixes. The
      rt2x00 char type fix is a larger (but still simple) commit, otherwise
      the fixes are small in size.
      
      * tag 'wireless-2022-11-03' of git://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless:
        wifi: ath11k: avoid deadlock during regulatory update in ath11k_regd_update()
        wifi: ath11k: Fix QCN9074 firmware boot on x86
        wifi: mac80211: Set TWT Information Frame Disabled bit as 1
        wifi: mac80211: Fix ack frame idr leak when mesh has no route
        wifi: mac80211: fix general-protection-fault in ieee80211_subif_start_xmit()
        wifi: brcmfmac: Fix potential buffer overflow in brcmf_fweh_event_worker()
        wifi: airo: do not assign -1 to unsigned char
        wifi: mac80211_hwsim: fix debugfs attribute ps with rc table support
        wifi: cfg80211: Fix bitrates overflow issue
        wifi: cfg80211: fix memory leak in query_regdb_file()
        wifi: mac80211: fix memory free error when registering wiphy fail
        wifi: cfg80211: silence a sparse RCU warning
        wifi: rt2x00: use explicitly signed or unsigned types
      ====================
      
      Link: https://lore.kernel.org/r/20221103125315.04E57C433C1@smtp.kernel.orgSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      91018bbc
    • J
      net: gso: fix panic on frag_list with mixed head alloc types · 9e4b7a99
      Jiri Benc 提交于
      Since commit 3dcbdb13 ("net: gso: Fix skb_segment splat when
      splitting gso_size mangled skb having linear-headed frag_list"), it is
      allowed to change gso_size of a GRO packet. However, that commit assumes
      that "checking the first list_skb member suffices; i.e if either of the
      list_skb members have non head_frag head, then the first one has too".
      
      It turns out this assumption does not hold. We've seen BUG_ON being hit
      in skb_segment when skbs on the frag_list had differing head_frag with
      the vmxnet3 driver. This happens because __netdev_alloc_skb and
      __napi_alloc_skb can return a skb that is page backed or kmalloced
      depending on the requested size. As the result, the last small skb in
      the GRO packet can be kmalloced.
      
      There are three different locations where this can be fixed:
      
      (1) We could check head_frag in GRO and not allow GROing skbs with
          different head_frag. However, that would lead to performance
          regression on normal forward paths with unmodified gso_size, where
          !head_frag in the last packet is not a problem.
      
      (2) Set a flag in bpf_skb_net_grow and bpf_skb_net_shrink indicating
          that NETIF_F_SG is undesirable. That would need to eat a bit in
          sk_buff. Furthermore, that flag can be unset when all skbs on the
          frag_list are page backed. To retain good performance,
          bpf_skb_net_grow/shrink would have to walk the frag_list.
      
      (3) Walk the frag_list in skb_segment when determining whether
          NETIF_F_SG should be cleared. This of course slows things down.
      
      This patch implements (3). To limit the performance impact in
      skb_segment, the list is walked only for skbs with SKB_GSO_DODGY set
      that have gso_size changed. Normal paths thus will not hit it.
      
      We could check only the last skb but since we need to walk the whole
      list anyway, let's stay on the safe side.
      
      Fixes: 3dcbdb13 ("net: gso: Fix skb_segment splat when splitting gso_size mangled skb having linear-headed frag_list")
      Signed-off-by: NJiri Benc <jbenc@redhat.com>
      Reviewed-by: NWillem de Bruijn <willemb@google.com>
      Link: https://lore.kernel.org/r/e04426a6a91baf4d1081e1b478c82b5de25fdf21.1667407944.git.jbenc@redhat.comSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      9e4b7a99
    • J
      Merge tag 'for-netdev' of https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf · f2c24be5
      Jakub Kicinski 提交于
      Daniel Borkmann says:
      
      ====================
      bpf 2022-11-04
      
      We've added 8 non-merge commits during the last 3 day(s) which contain
      a total of 10 files changed, 113 insertions(+), 16 deletions(-).
      
      The main changes are:
      
      1) Fix memory leak upon allocation failure in BPF verifier's stack state
         tracking, from Kees Cook.
      
      2) Fix address leakage when BPF progs release reference to an object,
         from Youlin Li.
      
      3) Fix BPF CI breakage from buggy in.h uapi header dependency,
         from Andrii Nakryiko.
      
      4) Fix bpftool pin sub-command's argument parsing, from Pu Lehui.
      
      5) Fix BPF sockmap lockdep warning by cancelling psock work outside
         of socket lock, from Cong Wang.
      
      6) Follow-up for BPF sockmap to fix sk_forward_alloc accounting,
         from Wang Yufen.
      
      bpf-for-netdev
      
      * tag 'for-netdev' of https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf:
        selftests/bpf: Add verifier test for release_reference()
        bpf: Fix wrong reg type conversion in release_reference()
        bpf, sock_map: Move cancel_work_sync() out of sock lock
        tools/headers: Pull in stddef.h to uapi to fix BPF selftests build in CI
        net/ipv4: Fix linux/in.h header dependencies
        bpftool: Fix NULL pointer dereference when pin {PROG, MAP, LINK} without FILE
        bpf, sockmap: Fix the sk->sk_forward_alloc warning of sk_stream_kill_queues
        bpf, verifier: Fix memory leak in array reallocation for stack state
      ====================
      
      Link: https://lore.kernel.org/r/20221104000445.30761-1-daniel@iogearbox.netSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      f2c24be5
    • Y
      selftests/bpf: Add verifier test for release_reference() · 475244f5
      Youlin Li 提交于
      Add a test case to ensure that released pointer registers will not be
      leaked into the map.
      
      Before fix:
      
        ./test_verifier 984
          984/u reference tracking: try to leak released ptr reg FAIL
          Unexpected success to load!
          verification time 67 usec
          stack depth 4
          processed 23 insns (limit 1000000) max_states_per_insn 0 total_states 2
          peak_states 2 mark_read 1
          984/p reference tracking: try to leak released ptr reg OK
          Summary: 1 PASSED, 0 SKIPPED, 1 FAILED
      
      After fix:
      
        ./test_verifier 984
          984/u reference tracking: try to leak released ptr reg OK
          984/p reference tracking: try to leak released ptr reg OK
          Summary: 2 PASSED, 0 SKIPPED, 0 FAILED
      Signed-off-by: NYoulin Li <liulin063@gmail.com>
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      Link: https://lore.kernel.org/bpf/20221103093440.3161-2-liulin063@gmail.com
      475244f5
    • Y
      bpf: Fix wrong reg type conversion in release_reference() · f1db2081
      Youlin Li 提交于
      Some helper functions will allocate memory. To avoid memory leaks, the
      verifier requires the eBPF program to release these memories by calling
      the corresponding helper functions.
      
      When a resource is released, all pointer registers corresponding to the
      resource should be invalidated. The verifier use release_references() to
      do this job, by apply  __mark_reg_unknown() to each relevant register.
      
      It will give these registers the type of SCALAR_VALUE. A register that
      will contain a pointer value at runtime, but of type SCALAR_VALUE, which
      may allow the unprivileged user to get a kernel pointer by storing this
      register into a map.
      
      Using __mark_reg_not_init() while NOT allow_ptr_leaks can mitigate this
      problem.
      
      Fixes: fd978bf7 ("bpf: Add reference tracking to verifier")
      Signed-off-by: NYoulin Li <liulin063@gmail.com>
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      Link: https://lore.kernel.org/bpf/20221103093440.3161-1-liulin063@gmail.com
      f1db2081
    • L
      Merge tag 'net-6.1-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net · 9521c9d6
      Linus Torvalds 提交于
      Pull networking fixes from Paolo Abeni:
       "Including fixes from bluetooth and netfilter.
      
        Current release - regressions:
      
         - net: several zerocopy flags fixes
      
         - netfilter: fix possible memory leak in nf_nat_init()
      
         - openvswitch: add missing .resv_start_op
      
        Previous releases - regressions:
      
         - neigh: fix null-ptr-deref in neigh_table_clear()
      
         - sched: fix use after free in red_enqueue()
      
         - dsa: fall back to default tagger if we can't load the one from DT
      
         - bluetooth: fix use-after-free in l2cap_conn_del()
      
        Previous releases - always broken:
      
         - netfilter: netlink notifier might race to release objects
      
         - nfc: fix potential memory leak of skb
      
         - bluetooth: fix use-after-free caused by l2cap_reassemble_sdu
      
         - bluetooth: use skb_put to set length
      
         - eth: tun: fix bugs for oversize packet when napi frags enabled
      
         - eth: lan966x: fixes for when MTU is changed
      
         - eth: dwmac-loongson: fix invalid mdio_node"
      
      * tag 'net-6.1-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (53 commits)
        vsock: fix possible infinite sleep in vsock_connectible_wait_data()
        vsock: remove the unused 'wait' in vsock_connectible_recvmsg()
        ipv6: fix WARNING in ip6_route_net_exit_late()
        bridge: Fix flushing of dynamic FDB entries
        net, neigh: Fix null-ptr-deref in neigh_table_clear()
        net/smc: Fix possible leaked pernet namespace in smc_init()
        stmmac: dwmac-loongson: fix invalid mdio_node
        ibmvnic: Free rwi on reset success
        net: mdio: fix undefined behavior in bit shift for __mdiobus_register
        Bluetooth: L2CAP: Fix attempting to access uninitialized memory
        Bluetooth: L2CAP: Fix l2cap_global_chan_by_psm
        Bluetooth: L2CAP: Fix accepting connection request for invalid SPSM
        Bluetooth: hci_conn: Fix not restoring ISO buffer count on disconnect
        Bluetooth: L2CAP: Fix memory leak in vhci_write
        Bluetooth: L2CAP: fix use-after-free in l2cap_conn_del()
        Bluetooth: virtio_bt: Use skb_put to set length
        Bluetooth: hci_conn: Fix CIS connection dst_type handling
        Bluetooth: L2CAP: Fix use-after-free caused by l2cap_reassemble_sdu
        netfilter: ipset: enforce documented limit to prevent allocating huge memory
        isdn: mISDN: netjet: fix wrong check of device registration
        ...
      9521c9d6
    • L
      Merge tag 'powerpc-6.1-4' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux · 4d740391
      Linus Torvalds 提交于
      Pull powerpc fixes from Michael Ellerman:
      
       - Fix an endian thinko in the asm-generic compat_arg_u64() which led to
         syscall arguments being swapped for some compat syscalls.
      
       - Fix syscall wrapper handling of syscalls with 64-bit arguments on
         32-bit kernels, which led to syscall arguments being misplaced.
      
       - A build fix for amdgpu on Book3E with AltiVec disabled.
      
      Thanks to Andreas Schwab, Christian Zigotzky, and Arnd Bergmann.
      
      * tag 'powerpc-6.1-4' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux:
        powerpc/32: Select ARCH_SPLIT_ARG64
        powerpc/32: fix syscall wrappers with 64-bit arguments
        asm-generic: compat: fix compat_arg_u64() and compat_arg_u64_dual()
        powerpc/64e: Fix amdgpu build on Book3E w/o AltiVec
      4d740391
  2. 03 11月, 2022 30 次提交
    • C
      bpf, sock_map: Move cancel_work_sync() out of sock lock · 8bbabb3f
      Cong Wang 提交于
      Stanislav reported a lockdep warning, which is caused by the
      cancel_work_sync() called inside sock_map_close(), as analyzed
      below by Jakub:
      
      psock->work.func = sk_psock_backlog()
        ACQUIRE psock->work_mutex
          sk_psock_handle_skb()
            skb_send_sock()
              __skb_send_sock()
                sendpage_unlocked()
                  kernel_sendpage()
                    sock->ops->sendpage = inet_sendpage()
                      sk->sk_prot->sendpage = tcp_sendpage()
                        ACQUIRE sk->sk_lock
                          tcp_sendpage_locked()
                        RELEASE sk->sk_lock
        RELEASE psock->work_mutex
      
      sock_map_close()
        ACQUIRE sk->sk_lock
        sk_psock_stop()
          sk_psock_clear_state(psock, SK_PSOCK_TX_ENABLED)
          cancel_work_sync()
            __cancel_work_timer()
              __flush_work()
                // wait for psock->work to finish
        RELEASE sk->sk_lock
      
      We can move the cancel_work_sync() out of the sock lock protection,
      but still before saved_close() was called.
      
      Fixes: 799aa7f9 ("skmsg: Avoid lock_sock() in sk_psock_backlog()")
      Reported-by: NStanislav Fomichev <sdf@google.com>
      Signed-off-by: NCong Wang <cong.wang@bytedance.com>
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      Tested-by: NJakub Sitnicki <jakub@cloudflare.com>
      Acked-by: NJohn Fastabend <john.fastabend@gmail.com>
      Acked-by: NJakub Sitnicki <jakub@cloudflare.com>
      Link: https://lore.kernel.org/bpf/20221102043417.279409-1-xiyou.wangcong@gmail.com
      8bbabb3f
    • A
      tools/headers: Pull in stddef.h to uapi to fix BPF selftests build in CI · a778f5d4
      Andrii Nakryiko 提交于
      With recent sync of linux/in.h tools/include headers are now relying on
      __DECLARE_FLEX_ARRAY macro, which isn't itself defined inside
      tools/include headers anywhere and is instead assumed to be present in
      system-wide UAPI header. This breaks isolated environments that don't
      have kernel UAPI headers installed system-wide, like BPF CI ([0]).
      
      To fix this, bring in include/uapi/linux/stddef.h into tools/include.
      We can't just copy/paste it, though, it has to be processed with
      scripts/headers_install.sh, which has a dependency on scripts/unifdef.
      So the full command to (re-)generate stddef.h for inclusion into
      tools/include directory is:
      
        $ make scripts_unifdef && \
          cp $KBUILD_OUTPUT/scripts/unifdef scripts/ && \
          scripts/headers_install.sh include/uapi/linux/stddef.h tools/include/uapi/linux/stddef.h
      
      This assumes KBUILD_OUTPUT envvar is set and used for out-of-tree builds.
      
        [0] https://github.com/kernel-patches/bpf/actions/runs/3379432493/jobs/5610982609
      
      Fixes: 036b8f5b ("tools headers uapi: Update linux/in.h copy")
      Signed-off-by: NAndrii Nakryiko <andrii@kernel.org>
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      Cc: Jakub Kicinski <kuba@kernel.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Link: https://lore.kernel.org/bpf/20221102182517.2675301-2-andrii@kernel.org
      a778f5d4
    • A
      net/ipv4: Fix linux/in.h header dependencies · aec1dc97
      Andrii Nakryiko 提交于
      __DECLARE_FLEX_ARRAY is defined in include/uapi/linux/stddef.h but
      doesn't seem to be explicitly included from include/uapi/linux/in.h,
      which breaks BPF selftests builds (once we sync linux/stddef.h into
      tools/include directory in the next patch). Fix this by explicitly
      including linux/stddef.h.
      
      Given this affects BPF CI and bpf tree, targeting this for bpf tree.
      
      Fixes: 5854a09b ("net/ipv4: Use __DECLARE_FLEX_ARRAY() helper")
      Signed-off-by: NAndrii Nakryiko <andrii@kernel.org>
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      Cc: Gustavo A. R. Silva <gustavoars@kernel.org>
      Cc: Jakub Kicinski <kuba@kernel.org>
      Link: https://lore.kernel.org/bpf/20221102182517.2675301-1-andrii@kernel.org
      aec1dc97
    • P
      Merge branch 'vsock-remove-an-unused-variable-and-fix-infinite-sleep' · 715aee0f
      Paolo Abeni 提交于
      Dexuan Cui says:
      
      ====================
      vsock: remove an unused variable and fix infinite sleep
      
      Patch 1 removes the unused 'wait' variable.
      Patch 2 fixes an infinite sleep issue reported by a hv_sock user.
      ====================
      
      Link: https://lore.kernel.org/r/20221101021706.26152-1-decui@microsoft.comSigned-off-by: NPaolo Abeni <pabeni@redhat.com>
      715aee0f
    • D
      vsock: fix possible infinite sleep in vsock_connectible_wait_data() · 466a8533
      Dexuan Cui 提交于
      Currently vsock_connectible_has_data() may miss a wakeup operation
      between vsock_connectible_has_data() == 0 and the prepare_to_wait().
      
      Fix the race by adding the process to the wait queue before checking
      vsock_connectible_has_data().
      
      Fixes: b3f7fd54 ("af_vsock: separate wait data loop")
      Signed-off-by: NDexuan Cui <decui@microsoft.com>
      Reviewed-by: NStefano Garzarella <sgarzare@redhat.com>
      Reported-by: NFrédéric Dalleau <frederic.dalleau@docker.com>
      Tested-by: NFrédéric Dalleau <frederic.dalleau@docker.com>
      Signed-off-by: NPaolo Abeni <pabeni@redhat.com>
      466a8533
    • D
      vsock: remove the unused 'wait' in vsock_connectible_recvmsg() · cf6ff0df
      Dexuan Cui 提交于
      Remove the unused variable introduced by 19c1b90e.
      
      Fixes: 19c1b90e ("af_vsock: separate receive data loop")
      Signed-off-by: NDexuan Cui <decui@microsoft.com>
      Reviewed-by: NStefano Garzarella <sgarzare@redhat.com>
      Signed-off-by: NPaolo Abeni <pabeni@redhat.com>
      cf6ff0df
    • Z
      ipv6: fix WARNING in ip6_route_net_exit_late() · 768b3c74
      Zhengchao Shao 提交于
      During the initialization of ip6_route_net_init_late(), if file
      ipv6_route or rt6_stats fails to be created, the initialization is
      successful by default. Therefore, the ipv6_route or rt6_stats file
      doesn't be found during the remove in ip6_route_net_exit_late(). It
      will cause WRNING.
      
      The following is the stack information:
      name 'rt6_stats'
      WARNING: CPU: 0 PID: 9 at fs/proc/generic.c:712 remove_proc_entry+0x389/0x460
      Modules linked in:
      Workqueue: netns cleanup_net
      RIP: 0010:remove_proc_entry+0x389/0x460
      PKRU: 55555554
      Call Trace:
      <TASK>
      ops_exit_list+0xb0/0x170
      cleanup_net+0x4ea/0xb00
      process_one_work+0x9bf/0x1710
      worker_thread+0x665/0x1080
      kthread+0x2e4/0x3a0
      ret_from_fork+0x1f/0x30
      </TASK>
      
      Fixes: cdb18761 ("[NETNS][IPV6] route6 - create route6 proc files for the namespace")
      Signed-off-by: NZhengchao Shao <shaozhengchao@huawei.com>
      Reviewed-by: NEric Dumazet <edumazet@google.com>
      Link: https://lore.kernel.org/r/20221102020610.351330-1-shaozhengchao@huawei.comSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      768b3c74
    • I
      bridge: Fix flushing of dynamic FDB entries · 628ac04a
      Ido Schimmel 提交于
      The following commands should result in all the dynamic FDB entries
      being flushed, but instead all the non-local (non-permanent) entries are
      flushed:
      
       # bridge fdb add 00:aa:bb:cc:dd:ee dev dummy1 master static
       # bridge fdb add 00:11:22:33:44:55 dev dummy1 master dynamic
       # ip link set dev br0 type bridge fdb_flush
       # bridge fdb show brport dummy1
       00:00:00:00:00:01 master br0 permanent
       33:33:00:00:00:01 self permanent
       01:00:5e:00:00:01 self permanent
      
      This is because br_fdb_flush() works with FDB flags and not the
      corresponding enumerator values. Fix by passing the FDB flag instead.
      
      After the fix:
      
       # bridge fdb add 00:aa:bb:cc:dd:ee dev dummy1 master static
       # bridge fdb add 00:11:22:33:44:55 dev dummy1 master dynamic
       # ip link set dev br0 type bridge fdb_flush
       # bridge fdb show brport dummy1
       00:aa:bb:cc:dd:ee master br0 static
       00:00:00:00:00:01 master br0 permanent
       33:33:00:00:00:01 self permanent
       01:00:5e:00:00:01 self permanent
      
      Fixes: 1f78ee14 ("net: bridge: fdb: add support for fine-grained flushing")
      Signed-off-by: NIdo Schimmel <idosch@nvidia.com>
      Acked-by: NNikolay Aleksandrov <razor@blackwall.org>
      Link: https://lore.kernel.org/r/20221101185753.2120691-1-idosch@nvidia.comSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      628ac04a
    • C
      net, neigh: Fix null-ptr-deref in neigh_table_clear() · f8017317
      Chen Zhongjin 提交于
      When IPv6 module gets initialized but hits an error in the middle,
      kenel panic with:
      
      KASAN: null-ptr-deref in range [0x0000000000000598-0x000000000000059f]
      CPU: 1 PID: 361 Comm: insmod
      Hardware name: QEMU Standard PC (i440FX + PIIX, 1996)
      RIP: 0010:__neigh_ifdown.isra.0+0x24b/0x370
      RSP: 0018:ffff888012677908 EFLAGS: 00000202
      ...
      Call Trace:
       <TASK>
       neigh_table_clear+0x94/0x2d0
       ndisc_cleanup+0x27/0x40 [ipv6]
       inet6_init+0x21c/0x2cb [ipv6]
       do_one_initcall+0xd3/0x4d0
       do_init_module+0x1ae/0x670
      ...
      Kernel panic - not syncing: Fatal exception
      
      When ipv6 initialization fails, it will try to cleanup and calls:
      
      neigh_table_clear()
        neigh_ifdown(tbl, NULL)
          pneigh_queue_purge(&tbl->proxy_queue, dev_net(dev == NULL))
          # dev_net(NULL) triggers null-ptr-deref.
      
      Fix it by passing NULL to pneigh_queue_purge() in neigh_ifdown() if dev
      is NULL, to make kernel not panic immediately.
      
      Fixes: 66ba215c ("neigh: fix possible DoS due to net iface start/stop loop")
      Signed-off-by: NChen Zhongjin <chenzhongjin@huawei.com>
      Reviewed-by: NEric Dumazet <edumazet@google.com>
      Reviewed-by: NDenis V. Lunev <den@openvz.org>
      Link: https://lore.kernel.org/r/20221101121552.21890-1-chenzhongjin@huawei.comSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      f8017317
    • C
      net/smc: Fix possible leaked pernet namespace in smc_init() · 62ff373d
      Chen Zhongjin 提交于
      In smc_init(), register_pernet_subsys(&smc_net_stat_ops) is called
      without any error handling.
      If it fails, registering of &smc_net_ops won't be reverted.
      And if smc_nl_init() fails, &smc_net_stat_ops itself won't be reverted.
      
      This leaves wild ops in subsystem linkedlist and when another module
      tries to call register_pernet_operations() it triggers page fault:
      
      BUG: unable to handle page fault for address: fffffbfff81b964c
      RIP: 0010:register_pernet_operations+0x1b9/0x5f0
      Call Trace:
        <TASK>
        register_pernet_subsys+0x29/0x40
        ebtables_init+0x58/0x1000 [ebtables]
        ...
      
      Fixes: 194730a9 ("net/smc: Make SMC statistics network namespace aware")
      Signed-off-by: NChen Zhongjin <chenzhongjin@huawei.com>
      Reviewed-by: NTony Lu <tonylu@linux.alibaba.com>
      Reviewed-by: NWenjia Zhang <wenjia@linux.ibm.com>
      Link: https://lore.kernel.org/r/20221101093722.127223-1-chenzhongjin@huawei.comSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      62ff373d
    • L
      stmmac: dwmac-loongson: fix invalid mdio_node · 2ae34111
      Liu Peibao 提交于
      In current code "plat->mdio_node" is always NULL, the mdio
      support is lost as there is no "mdio_bus_data". The original
      driver could work as the "mdio" variable is never set to
      false, which is described in commit <b0e03950> ("stmmac:
      dwmac-loongson: fix uninitialized variable ......"). And
      after this commit merged, the "mdio" variable is always
      false, causing the mdio supoort logic lost.
      
      Fixes: 30bba69d ("stmmac: pci: Add dwmac support for Loongson")
      Signed-off-by: NLiu Peibao <liupeibao@loongson.cn>
      Reviewed-by: NAndrew Lunn <andrew@lunn.ch>
      Link: https://lore.kernel.org/r/20221101060218.16453-1-liupeibao@loongson.cnSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      2ae34111
    • N
      ibmvnic: Free rwi on reset success · d6dd2fe7
      Nick Child 提交于
      Free the rwi structure in the event that the last rwi in the list
      processed successfully. The logic in commit 4f408e1f ("ibmvnic:
      retry reset if there are no other resets") introduces an issue that
      results in a 32 byte memory leak whenever the last rwi in the list
      gets processed.
      
      Fixes: 4f408e1f ("ibmvnic: retry reset if there are no other resets")
      Signed-off-by: NNick Child <nnac123@linux.ibm.com>
      Link: https://lore.kernel.org/r/20221031150642.13356-1-nnac123@linux.ibm.comSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      d6dd2fe7
    • G
      net: mdio: fix undefined behavior in bit shift for __mdiobus_register · 40e4eb32
      Gaosheng Cui 提交于
      Shifting signed 32-bit value by 31 bits is undefined, so changing
      significant bit to unsigned. The UBSAN warning calltrace like below:
      
      UBSAN: shift-out-of-bounds in drivers/net/phy/mdio_bus.c:586:27
      left shift of 1 by 31 places cannot be represented in type 'int'
      Call Trace:
       <TASK>
       dump_stack_lvl+0x7d/0xa5
       dump_stack+0x15/0x1b
       ubsan_epilogue+0xe/0x4e
       __ubsan_handle_shift_out_of_bounds+0x1e7/0x20c
       __mdiobus_register+0x49d/0x4e0
       fixed_mdio_bus_init+0xd8/0x12d
       do_one_initcall+0x76/0x430
       kernel_init_freeable+0x3b3/0x422
       kernel_init+0x24/0x1e0
       ret_from_fork+0x1f/0x30
       </TASK>
      
      Fixes: 4fd5f812 ("phylib: allow incremental scanning of an mii bus")
      Signed-off-by: NGaosheng Cui <cuigaosheng1@huawei.com>
      Reviewed-by: NAndrew Lunn <andrew@lunn.ch>
      Link: https://lore.kernel.org/r/20221031132645.168421-1-cuigaosheng1@huawei.comSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      40e4eb32
    • J
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf · dac1dc7e
      Jakub Kicinski 提交于
      Pablo Neira Ayuso says:
      
      ====================
      Netfilter/IPVS fixes for net
      
      1) netlink socket notifier might win race to release objects that are
         already pending to be released via commit release path, reported by
         syzbot.
      
      2) No need to postpone flow rule release to commit release path, this
         triggered the syzbot report, complementary fix to previous patch.
      
      3) Use explicit signed chars in IPVS to unbreak arm, from Jason A. Donenfeld.
      
      4) Missing check for proc entry creation failure in IPVS, from Zhengchao Shao.
      
      5) Incorrect error path handling when BPF NAT fails to register, from
         Chen Zhongjin.
      
      6) Prevent huge memory allocation in ipset hash types, from Jozsef Kadlecsik.
      
      Except the incorrect BPF NAT error path which is broken in 6.1-rc, anything
      else has been broken for several releases.
      
      * git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf:
        netfilter: ipset: enforce documented limit to prevent allocating huge memory
        netfilter: nf_nat: Fix possible memory leak in nf_nat_init()
        ipvs: fix WARNING in ip_vs_app_net_cleanup()
        ipvs: fix WARNING in __ip_vs_cleanup_batch()
        ipvs: use explicitly signed chars
        netfilter: nf_tables: release flow rule object from commit path
        netfilter: nf_tables: netlink notifier might race to release objects
      ====================
      
      Link: https://lore.kernel.org/r/20221102184659.2502-1-pablo@netfilter.orgSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      dac1dc7e
    • J
      Merge tag 'for-net-2022-10-02' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth · ef1fdc93
      Jakub Kicinski 提交于
      Luiz Augusto von Dentz says:
      
      ====================
      bluetooth 2022-11-02
      
       - Fix memory leak in hci_vhci driver
       - Fix handling of skb on virtio_bt driver
       - Fix accepting connection for invalid L2CAP PSM
       - Fix attemting to access uninitialized memory
       - Fix use-after-free in l2cap_reassemble_sdu
       - Fix use-after-free in l2cap_conn_del
       - Fix handling of destination address type for CIS
       - Fix not restoring ISO buffer count on disconnect
      
      * tag 'for-net-2022-10-02' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth:
        Bluetooth: L2CAP: Fix attempting to access uninitialized memory
        Bluetooth: L2CAP: Fix l2cap_global_chan_by_psm
        Bluetooth: L2CAP: Fix accepting connection request for invalid SPSM
        Bluetooth: hci_conn: Fix not restoring ISO buffer count on disconnect
        Bluetooth: L2CAP: Fix memory leak in vhci_write
        Bluetooth: L2CAP: fix use-after-free in l2cap_conn_del()
        Bluetooth: virtio_bt: Use skb_put to set length
        Bluetooth: hci_conn: Fix CIS connection dst_type handling
        Bluetooth: L2CAP: Fix use-after-free caused by l2cap_reassemble_sdu
      ====================
      
      Link: https://lore.kernel.org/r/20221102235927.3324891-1-luiz.dentz@gmail.comSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      ef1fdc93
    • L
      Bluetooth: L2CAP: Fix attempting to access uninitialized memory · b1a2cd50
      Luiz Augusto von Dentz 提交于
      On l2cap_parse_conf_req the variable efs is only initialized if
      remote_efs has been set.
      
      CVE: CVE-2022-42895
      CC: stable@vger.kernel.org
      Reported-by: NTamás Koczka <poprdi@google.com>
      Signed-off-by: NLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      Reviewed-by: NTedd Ho-Jeong An <tedd.an@intel.com>
      b1a2cd50
    • L
      Bluetooth: L2CAP: Fix l2cap_global_chan_by_psm · f937b758
      Luiz Augusto von Dentz 提交于
      l2cap_global_chan_by_psm shall not return fixed channels as they are not
      meant to be connected by (S)PSM.
      Signed-off-by: NLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      Reviewed-by: NTedd Ho-Jeong An <tedd.an@intel.com>
      f937b758
    • L
      Bluetooth: L2CAP: Fix accepting connection request for invalid SPSM · 711f8c3f
      Luiz Augusto von Dentz 提交于
      The Bluetooth spec states that the valid range for SPSM is from
      0x0001-0x00ff so it is invalid to accept values outside of this range:
      
        BLUETOOTH CORE SPECIFICATION Version 5.3 | Vol 3, Part A
        page 1059:
        Table 4.15: L2CAP_LE_CREDIT_BASED_CONNECTION_REQ SPSM ranges
      
      CVE: CVE-2022-42896
      CC: stable@vger.kernel.org
      Reported-by: NTamás Koczka <poprdi@google.com>
      Signed-off-by: NLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      Reviewed-by: NTedd Ho-Jeong An <tedd.an@intel.com>
      711f8c3f
    • L
      Bluetooth: hci_conn: Fix not restoring ISO buffer count on disconnect · 5638d9ea
      Luiz Augusto von Dentz 提交于
      When disconnecting an ISO link the controller may not generate
      HCI_EV_NUM_COMP_PKTS for unacked packets which needs to be restored in
      hci_conn_del otherwise the host would assume they are still in use and
      would not be able to use all the buffers available.
      
      Fixes: 26afbd82 ("Bluetooth: Add initial implementation of CIS connections")
      Signed-off-by: NLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      Tested-by: NFrédéric Danis <frederic.danis@collabora.com>
      5638d9ea
    • H
      Bluetooth: L2CAP: Fix memory leak in vhci_write · 7c9524d9
      Hawkins Jiawei 提交于
      Syzkaller reports a memory leak as follows:
      ====================================
      BUG: memory leak
      unreferenced object 0xffff88810d81ac00 (size 240):
        [...]
        hex dump (first 32 bytes):
          00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
          00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
        backtrace:
          [<ffffffff838733d9>] __alloc_skb+0x1f9/0x270 net/core/skbuff.c:418
          [<ffffffff833f742f>] alloc_skb include/linux/skbuff.h:1257 [inline]
          [<ffffffff833f742f>] bt_skb_alloc include/net/bluetooth/bluetooth.h:469 [inline]
          [<ffffffff833f742f>] vhci_get_user drivers/bluetooth/hci_vhci.c:391 [inline]
          [<ffffffff833f742f>] vhci_write+0x5f/0x230 drivers/bluetooth/hci_vhci.c:511
          [<ffffffff815e398d>] call_write_iter include/linux/fs.h:2192 [inline]
          [<ffffffff815e398d>] new_sync_write fs/read_write.c:491 [inline]
          [<ffffffff815e398d>] vfs_write+0x42d/0x540 fs/read_write.c:578
          [<ffffffff815e3cdd>] ksys_write+0x9d/0x160 fs/read_write.c:631
          [<ffffffff845e0645>] do_syscall_x64 arch/x86/entry/common.c:50 [inline]
          [<ffffffff845e0645>] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
          [<ffffffff84600087>] entry_SYSCALL_64_after_hwframe+0x63/0xcd
      ====================================
      
      HCI core will uses hci_rx_work() to process frame, which is queued to
      the hdev->rx_q tail in hci_recv_frame() by HCI driver.
      
      Yet the problem is that, HCI core may not free the skb after handling
      ACL data packets. To be more specific, when start fragment does not
      contain the L2CAP length, HCI core just copies skb into conn->rx_skb and
      finishes frame process in l2cap_recv_acldata(), without freeing the skb,
      which triggers the above memory leak.
      
      This patch solves it by releasing the relative skb, after processing
      the above case in l2cap_recv_acldata().
      
      Fixes: 4d7ea8ee ("Bluetooth: L2CAP: Fix handling fragmented length")
      Link: https://lore.kernel.org/all/0000000000000d0b1905e6aaef64@google.com/
      Reported-and-tested-by: syzbot+8f819e36e01022991cfa@syzkaller.appspotmail.com
      Signed-off-by: NHawkins Jiawei <yin31149@gmail.com>
      Signed-off-by: NLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      7c9524d9
    • Z
      Bluetooth: L2CAP: fix use-after-free in l2cap_conn_del() · 0d0e2d03
      Zhengchao Shao 提交于
      When l2cap_recv_frame() is invoked to receive data, and the cid is
      L2CAP_CID_A2MP, if the channel does not exist, it will create a channel.
      However, after a channel is created, the hold operation of the channel
      is not performed. In this case, the value of channel reference counting
      is 1. As a result, after hci_error_reset() is triggered, l2cap_conn_del()
      invokes the close hook function of A2MP to release the channel. Then
       l2cap_chan_unlock(chan) will trigger UAF issue.
      
      The process is as follows:
      Receive data:
      l2cap_data_channel()
          a2mp_channel_create()  --->channel ref is 2
          l2cap_chan_put()       --->channel ref is 1
      
      Triger event:
          hci_error_reset()
              hci_dev_do_close()
              ...
              l2cap_disconn_cfm()
                  l2cap_conn_del()
                      l2cap_chan_hold()    --->channel ref is 2
                      l2cap_chan_del()     --->channel ref is 1
                      a2mp_chan_close_cb() --->channel ref is 0, release channel
                      l2cap_chan_unlock()  --->UAF of channel
      
      The detailed Call Trace is as follows:
      BUG: KASAN: use-after-free in __mutex_unlock_slowpath+0xa6/0x5e0
      Read of size 8 at addr ffff8880160664b8 by task kworker/u11:1/7593
      Workqueue: hci0 hci_error_reset
      Call Trace:
       <TASK>
       dump_stack_lvl+0xcd/0x134
       print_report.cold+0x2ba/0x719
       kasan_report+0xb1/0x1e0
       kasan_check_range+0x140/0x190
       __mutex_unlock_slowpath+0xa6/0x5e0
       l2cap_conn_del+0x404/0x7b0
       l2cap_disconn_cfm+0x8c/0xc0
       hci_conn_hash_flush+0x11f/0x260
       hci_dev_close_sync+0x5f5/0x11f0
       hci_dev_do_close+0x2d/0x70
       hci_error_reset+0x9e/0x140
       process_one_work+0x98a/0x1620
       worker_thread+0x665/0x1080
       kthread+0x2e4/0x3a0
       ret_from_fork+0x1f/0x30
       </TASK>
      
      Allocated by task 7593:
       kasan_save_stack+0x1e/0x40
       __kasan_kmalloc+0xa9/0xd0
       l2cap_chan_create+0x40/0x930
       amp_mgr_create+0x96/0x990
       a2mp_channel_create+0x7d/0x150
       l2cap_recv_frame+0x51b8/0x9a70
       l2cap_recv_acldata+0xaa3/0xc00
       hci_rx_work+0x702/0x1220
       process_one_work+0x98a/0x1620
       worker_thread+0x665/0x1080
       kthread+0x2e4/0x3a0
       ret_from_fork+0x1f/0x30
      
      Freed by task 7593:
       kasan_save_stack+0x1e/0x40
       kasan_set_track+0x21/0x30
       kasan_set_free_info+0x20/0x30
       ____kasan_slab_free+0x167/0x1c0
       slab_free_freelist_hook+0x89/0x1c0
       kfree+0xe2/0x580
       l2cap_chan_put+0x22a/0x2d0
       l2cap_conn_del+0x3fc/0x7b0
       l2cap_disconn_cfm+0x8c/0xc0
       hci_conn_hash_flush+0x11f/0x260
       hci_dev_close_sync+0x5f5/0x11f0
       hci_dev_do_close+0x2d/0x70
       hci_error_reset+0x9e/0x140
       process_one_work+0x98a/0x1620
       worker_thread+0x665/0x1080
       kthread+0x2e4/0x3a0
       ret_from_fork+0x1f/0x30
      
      Last potentially related work creation:
       kasan_save_stack+0x1e/0x40
       __kasan_record_aux_stack+0xbe/0xd0
       call_rcu+0x99/0x740
       netlink_release+0xe6a/0x1cf0
       __sock_release+0xcd/0x280
       sock_close+0x18/0x20
       __fput+0x27c/0xa90
       task_work_run+0xdd/0x1a0
       exit_to_user_mode_prepare+0x23c/0x250
       syscall_exit_to_user_mode+0x19/0x50
       do_syscall_64+0x42/0x80
       entry_SYSCALL_64_after_hwframe+0x63/0xcd
      
      Second to last potentially related work creation:
       kasan_save_stack+0x1e/0x40
       __kasan_record_aux_stack+0xbe/0xd0
       call_rcu+0x99/0x740
       netlink_release+0xe6a/0x1cf0
       __sock_release+0xcd/0x280
       sock_close+0x18/0x20
       __fput+0x27c/0xa90
       task_work_run+0xdd/0x1a0
       exit_to_user_mode_prepare+0x23c/0x250
       syscall_exit_to_user_mode+0x19/0x50
       do_syscall_64+0x42/0x80
       entry_SYSCALL_64_after_hwframe+0x63/0xcd
      
      Fixes: d0be8347 ("Bluetooth: L2CAP: Fix use-after-free caused by l2cap_chan_put")
      Signed-off-by: NZhengchao Shao <shaozhengchao@huawei.com>
      Signed-off-by: NLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      0d0e2d03
    • S
      Bluetooth: virtio_bt: Use skb_put to set length · 160fbcf3
      Soenke Huster 提交于
      By using skb_put we ensure that skb->tail is set
      correctly. Currently, skb->tail is always zero, which
      leads to errors, such as the following page fault in
      rfcomm_recv_frame:
      
          BUG: unable to handle page fault for address: ffffed1021de29ff
          #PF: supervisor read access in kernel mode
          #PF: error_code(0x0000) - not-present page
          RIP: 0010:rfcomm_run+0x831/0x4040 (net/bluetooth/rfcomm/core.c:1751)
      
      Fixes: afd2daa2 ("Bluetooth: Add support for virtio transport driver")
      Signed-off-by: NSoenke Huster <soenke.huster@eknoes.de>
      Signed-off-by: NLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      160fbcf3
    • P
      Bluetooth: hci_conn: Fix CIS connection dst_type handling · b36a234d
      Pauli Virtanen 提交于
      hci_connect_cis and iso_connect_cis call hci_bind_cis inconsistently
      with dst_type being either ISO socket address type or the HCI type, but
      these values cannot be mixed like this. Fix this by using only the HCI
      type.
      
      CIS connection dst_type was also not initialized in hci_bind_cis, even
      though it is used in hci_conn_hash_lookup_cis to find existing
      connections.  Set the value in hci_bind_cis, so that existing CIS
      connections are found e.g. when doing deferred socket connections, also
      when dst_type is not 0 (ADDR_LE_DEV_PUBLIC).
      
      Fixes: 26afbd82 ("Bluetooth: Add initial implementation of CIS connections")
      Signed-off-by: NPauli Virtanen <pav@iki.fi>
      Signed-off-by: NLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      b36a234d
    • M
      Bluetooth: L2CAP: Fix use-after-free caused by l2cap_reassemble_sdu · 3aff8aac
      Maxim Mikityanskiy 提交于
      Fix the race condition between the following two flows that run in
      parallel:
      
      1. l2cap_reassemble_sdu -> chan->ops->recv (l2cap_sock_recv_cb) ->
         __sock_queue_rcv_skb.
      
      2. bt_sock_recvmsg -> skb_recv_datagram, skb_free_datagram.
      
      An SKB can be queued by the first flow and immediately dequeued and
      freed by the second flow, therefore the callers of l2cap_reassemble_sdu
      can't use the SKB after that function returns. However, some places
      continue accessing struct l2cap_ctrl that resides in the SKB's CB for a
      short time after l2cap_reassemble_sdu returns, leading to a
      use-after-free condition (the stack trace is below, line numbers for
      kernel 5.19.8).
      
      Fix it by keeping a local copy of struct l2cap_ctrl.
      
      BUG: KASAN: use-after-free in l2cap_rx_state_recv (net/bluetooth/l2cap_core.c:6906) bluetooth
      Read of size 1 at addr ffff88812025f2f0 by task kworker/u17:3/43169
      
      Workqueue: hci0 hci_rx_work [bluetooth]
      Call Trace:
       <TASK>
       dump_stack_lvl (lib/dump_stack.c:107 (discriminator 4))
       print_report.cold (mm/kasan/report.c:314 mm/kasan/report.c:429)
       ? l2cap_rx_state_recv (net/bluetooth/l2cap_core.c:6906) bluetooth
       kasan_report (mm/kasan/report.c:162 mm/kasan/report.c:493)
       ? l2cap_rx_state_recv (net/bluetooth/l2cap_core.c:6906) bluetooth
       l2cap_rx_state_recv (net/bluetooth/l2cap_core.c:6906) bluetooth
       l2cap_rx (net/bluetooth/l2cap_core.c:7236 net/bluetooth/l2cap_core.c:7271) bluetooth
       ret_from_fork (arch/x86/entry/entry_64.S:306)
       </TASK>
      
      Allocated by task 43169:
       kasan_save_stack (mm/kasan/common.c:39)
       __kasan_slab_alloc (mm/kasan/common.c:45 mm/kasan/common.c:436 mm/kasan/common.c:469)
       kmem_cache_alloc_node (mm/slab.h:750 mm/slub.c:3243 mm/slub.c:3293)
       __alloc_skb (net/core/skbuff.c:414)
       l2cap_recv_frag (./include/net/bluetooth/bluetooth.h:425 net/bluetooth/l2cap_core.c:8329) bluetooth
       l2cap_recv_acldata (net/bluetooth/l2cap_core.c:8442) bluetooth
       hci_rx_work (net/bluetooth/hci_core.c:3642 net/bluetooth/hci_core.c:3832) bluetooth
       process_one_work (kernel/workqueue.c:2289)
       worker_thread (./include/linux/list.h:292 kernel/workqueue.c:2437)
       kthread (kernel/kthread.c:376)
       ret_from_fork (arch/x86/entry/entry_64.S:306)
      
      Freed by task 27920:
       kasan_save_stack (mm/kasan/common.c:39)
       kasan_set_track (mm/kasan/common.c:45)
       kasan_set_free_info (mm/kasan/generic.c:372)
       ____kasan_slab_free (mm/kasan/common.c:368 mm/kasan/common.c:328)
       slab_free_freelist_hook (mm/slub.c:1780)
       kmem_cache_free (mm/slub.c:3536 mm/slub.c:3553)
       skb_free_datagram (./include/net/sock.h:1578 ./include/net/sock.h:1639 net/core/datagram.c:323)
       bt_sock_recvmsg (net/bluetooth/af_bluetooth.c:295) bluetooth
       l2cap_sock_recvmsg (net/bluetooth/l2cap_sock.c:1212) bluetooth
       sock_read_iter (net/socket.c:1087)
       new_sync_read (./include/linux/fs.h:2052 fs/read_write.c:401)
       vfs_read (fs/read_write.c:482)
       ksys_read (fs/read_write.c:620)
       do_syscall_64 (arch/x86/entry/common.c:50 arch/x86/entry/common.c:80)
       entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:120)
      
      Link: https://lore.kernel.org/linux-bluetooth/CAKErNvoqga1WcmoR3-0875esY6TVWFQDandbVZncSiuGPBQXLA@mail.gmail.com/T/#u
      Fixes: d2a7ac5d ("Bluetooth: Add the ERTM receive state machine")
      Fixes: 4b51dae9 ("Bluetooth: Add streaming mode receive and incoming packet classifier")
      Signed-off-by: NMaxim Mikityanskiy <maxtram95@gmail.com>
      Signed-off-by: NLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      3aff8aac
    • L
      Merge tag 'parisc-for-6.1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux · 8e5423e9
      Linus Torvalds 提交于
      Pull parisc architecture fixes from Helge Deller:
       "This mostly handles oddities with the serial port 8250_gsc.c driver.
      
        Although the name suggests it's just for serial ports on the GSC bus
        (e.g. in older PA-RISC machines), it handles serial ports on PA-RISC
        PCI devices (e.g. on the SuperIO chip) as well.
      
        Thus this renames the driver to 8250_parisc and fixes the config
        dependencies.
      
        The other change is a cleanup on how the device IDs of devices in a
        PA-RISC machine are shown at startup"
      
      * tag 'parisc-for-6.1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux:
        parisc: Avoid printing the hardware path twice
        parisc: Export iosapic_serial_irq() symbol for serial port driver
        MAINTAINERS: adjust entry after renaming parisc serial driver
        parisc: Use signed char for hardware path in pdc.h
        parisc/serial: Rename 8250_gsc.c to 8250_parisc.c
        parisc: Make 8250_gsc driver dependend on CONFIG_PARISC
      8e5423e9
    • J
      netfilter: ipset: enforce documented limit to prevent allocating huge memory · 510841da
      Jozsef Kadlecsik 提交于
      Daniel Xu reported that the hash:net,iface type of the ipset subsystem does
      not limit adding the same network with different interfaces to a set, which
      can lead to huge memory usage or allocation failure.
      
      The quick reproducer is
      
      $ ipset create ACL.IN.ALL_PERMIT hash:net,iface hashsize 1048576 timeout 0
      $ for i in $(seq 0 100); do /sbin/ipset add ACL.IN.ALL_PERMIT 0.0.0.0/0,kaf_$i timeout 0 -exist; done
      
      The backtrace when vmalloc fails:
      
              [Tue Oct 25 00:13:08 2022] ipset: vmalloc error: size 1073741848, exceeds total pages
              <...>
              [Tue Oct 25 00:13:08 2022] Call Trace:
              [Tue Oct 25 00:13:08 2022]  <TASK>
              [Tue Oct 25 00:13:08 2022]  dump_stack_lvl+0x48/0x60
              [Tue Oct 25 00:13:08 2022]  warn_alloc+0x155/0x180
              [Tue Oct 25 00:13:08 2022]  __vmalloc_node_range+0x72a/0x760
              [Tue Oct 25 00:13:08 2022]  ? hash_netiface4_add+0x7c0/0xb20
              [Tue Oct 25 00:13:08 2022]  ? __kmalloc_large_node+0x4a/0x90
              [Tue Oct 25 00:13:08 2022]  kvmalloc_node+0xa6/0xd0
              [Tue Oct 25 00:13:08 2022]  ? hash_netiface4_resize+0x99/0x710
              <...>
      
      The fix is to enforce the limit documented in the ipset(8) manpage:
      
      >  The internal restriction of the hash:net,iface set type is that the same
      >  network prefix cannot be stored with more than 64 different interfaces
      >  in a single set.
      
      Fixes: ccf0a4b7 ("netfilter: ipset: Add bucketsize parameter to all hash types")
      Reported-by: NDaniel Xu <dxu@dxuuu.xyz>
      Signed-off-by: NJozsef Kadlecsik <kadlec@netfilter.org>
      Signed-off-by: NPablo Neira Ayuso <pablo@netfilter.org>
      510841da
    • L
      Merge tag 'nfs-for-6.1-2' of git://git.linux-nfs.org/projects/anna/linux-nfs · 31fc92fc
      Linus Torvalds 提交于
      Pull NFS client bugfixes from Anna Schumaker:
      
       - Fix some coccicheck warnings
      
       - Avoid memcpy() run-time warning
      
       - Fix up various state reclaim / RECLAIM_COMPLETE errors
      
       - Fix a null pointer dereference in sysfs
      
       - Fix LOCK races
      
       - Fix gss_unwrap_resp_integ() crasher
      
       - Fix zero length clones
      
       - Fix memleak when allocate slot fails
      
      * tag 'nfs-for-6.1-2' of git://git.linux-nfs.org/projects/anna/linux-nfs:
        nfs4: Fix kmemleak when allocate slot failed
        NFSv4.2: Fixup CLONE dest file size for zero-length count
        SUNRPC: Fix crasher in gss_unwrap_resp_integ()
        NFSv4: Retry LOCK on OLD_STATEID during delegation return
        SUNRPC: Fix null-ptr-deref when xps sysfs alloc failed
        NFSv4.1: We must always send RECLAIM_COMPLETE after a reboot
        NFSv4.1: Handle RECLAIM_COMPLETE trunking errors
        NFSv4: Fix a potential state reclaim deadlock
        NFS: Avoid memcpy() run-time warning for struct sockaddr overflows
        nfs: Remove redundant null checks before kfree
      31fc92fc
    • L
      Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma · ae13366b
      Linus Torvalds 提交于
      Pull rdma fixes from Jason Gunthorpe:
       "Fix a few more of the usual sorts of bugs:
      
         - Another regression with source route validation in CMA, introduced
           this merge window
      
         - Crash in hfi1 due to faulty list operations
      
         - PCI ID updates for EFA
      
         - Disable LOCAL_INV in hns because it causes a HW hang
      
         - Crash in hns due to missing initialization
      
         - Memory leak in rxe
      
         - Missing error unwind during ib_core module loading
      
         - Missing error handling in qedr around work queue creation during
           startup"
      
      * tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma:
        RDMA/qedr: clean up work queue on failure in qedr_alloc_resources()
        RDMA/core: Fix null-ptr-deref in ib_core_cleanup()
        RDMA/rxe: Fix mr leak in RESPST_ERR_RNR
        RDMA/hns: Fix NULL pointer problem in free_mr_init()
        RDMA/hns: Disable local invalidate operation
        RDMA/efa: Add EFA 0xefa2 PCI ID
        IB/hfi1: Correctly move list in sc_disable()
        RDMA/cma: Use output interface for net_dev check
      ae13366b
    • W
      wifi: ath11k: avoid deadlock during regulatory update in ath11k_regd_update() · f45cb6b2
      Wen Gong 提交于
      (cherry picked from commit d99884ad in ath-next
      as users are seeing this bug more now, also cc stable)
      
      Running this test in a loop it is easy to reproduce an rtnl deadlock:
      
      iw reg set FI
      ifconfig wlan0 down
      
      What happens is that thread A (workqueue) tries to update the regulatory:
      
          try to acquire the rtnl_lock of ar->regd_update_work
      
          rtnl_lock+0x17/0x20
          ath11k_regd_update+0x15a/0x260 [ath11k]
          ath11k_regd_update_work+0x15/0x20 [ath11k]
          process_one_work+0x228/0x670
          worker_thread+0x4d/0x440
          kthread+0x16d/0x1b0
          ret_from_fork+0x22/0x30
      
      And thread B (ifconfig) tries to stop the interface:
      
          try to cancel_work_sync(&ar->regd_update_work) in ath11k_mac_op_stop().
          ifconfig  3109 [003]  2414.232506: probe:
      
          ath11k_mac_op_stop: (ffffffffc14187a0)
          drv_stop+0x30 ([mac80211])
          ieee80211_do_stop+0x5d2 ([mac80211])
          ieee80211_stop+0x3e ([mac80211])
          __dev_close_many+0x9e ([kernel.kallsyms])
          __dev_change_flags+0xbe ([kernel.kallsyms])
          dev_change_flags+0x23 ([kernel.kallsyms])
          devinet_ioctl+0x5e3 ([kernel.kallsyms])
          inet_ioctl+0x197 ([kernel.kallsyms])
          sock_do_ioctl+0x4d ([kernel.kallsyms])
          sock_ioctl+0x264 ([kernel.kallsyms])
          __x64_sys_ioctl+0x92 ([kernel.kallsyms])
          do_syscall_64+0x3a ([kernel.kallsyms])
          entry_SYSCALL_64_after_hwframe+0x63 ([kernel.kallsyms])
          __GI___ioctl+0x7 (/lib/x86_64-linux-gnu/libc-2.23.so)
      
      The sequence of deadlock is:
      
      1. Thread B calls rtnl_lock().
      
      2. Thread A starts to run and calls rtnl_lock() from within
         ath11k_regd_update_work(), then enters wait state because the lock is owned by
         thread B.
      
      3. Thread B continues to run and tries to call
         cancel_work_sync(&ar->regd_update_work), but thread A is in
         ath11k_regd_update_work() waiting for rtnl_lock(). So cancel_work_sync()
         forever waits for ath11k_regd_update_work() to finish and we have a deadlock.
      
      Fix this by switching from using regulatory_set_wiphy_regd_sync() to
      regulatory_set_wiphy_regd(). Now cfg80211 will schedule another workqueue which
      handles the locking on it's own. So the ath11k workqueue can simply exit without
      taking any locks, avoiding the deadlock.
      
      Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3
      
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NWen Gong <quic_wgong@quicinc.com>
      [kvalo: improve commit log]
      Signed-off-by: NKalle Valo <quic_kvalo@quicinc.com>
      f45cb6b2
    • T
      wifi: ath11k: Fix QCN9074 firmware boot on x86 · 3a89b6de
      Tyler J. Stachecki 提交于
      The 2.7.0 series of QCN9074's firmware requests 5 segments
      of memory instead of 3 (as in the 2.5.0 series).
      
      The first segment (11M) is too large to be kalloc'd in one
      go on x86 and requires piecemeal 1MB allocations, as was
      the case with the prior public firmware (2.5.0, 15M).
      
      Since f6f92968, ath11k will break the memory requests,
      but only if there were fewer than 3 segments requested by
      the firmware. It seems that 5 segments works fine and
      allows QCN9074 to boot on x86 with firmware 2.7.0, so
      change things accordingly.
      
      Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1
      Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.5.0.1-01208-QCAHKSWPL_SILICONZ-1
      Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3.6510.16
      Signed-off-by: NTyler J. Stachecki <stachecki.tyler@gmail.com>
      Signed-off-by: NKalle Valo <quic_kvalo@quicinc.com>
      Link: https://lore.kernel.org/r/20221022042728.43015-1-stachecki.tyler@gmail.com
      3a89b6de
  3. 02 11月, 2022 3 次提交