Skip to content
  1. Jan 28, 2023
  2. Jan 27, 2023
    • Linus Torvalds's avatar
      Merge tag 'net-6.2-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net · 28b4387f
      Linus Torvalds authored
      Pull networking fixes from Paolo Abeni:
       "Including fixes from netfilter.
      
        Current release - regressions:
      
         - sched: sch_taprio: do not schedule in taprio_reset()
      
        Previous releases - regressions:
      
         - core: fix UaF in netns ops registration error path
      
         - ipv4: prevent potential spectre v1 gadgets
      
         - ipv6: fix reachability confirmation with proxy_ndp
      
         - netfilter: fix for the set rbtree
      
         - eth: fec: use page_pool_put_full_page when freeing rx buffers
      
         - eth: iavf: fix temporary deadlock and failure to set MAC address
      
        Previous releases - always broken:
      
         - netlink: prevent potential spectre v1 gadgets
      
         - netfilter: fixes for SCTP connection tracking
      
         - mctp: struct sock lifetime fixes
      
         - eth: ravb: fix possible hang if RIS2_QFF1 happen
      
         - eth: tg3: resolve deadlock in tg3_reset_task() during EEH
      
        Misc:
      
         - Mat stepped out as MPTCP co-maintainer"
      
      * tag 'net-6.2-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (40 commits)
        net: mdio-mux-meson-g12a: force internal PHY off on mux switch
        docs: networking: Fix bridge documentation URL
        tsnep: Fix TX queue stop/wake for multiple queues
        net/tg3: resolve deadlock in tg3_reset_task() during EEH
        net: mctp: mark socks as dead on unhash, prevent re-add
        net: mctp: hold key reference when looking up a general key
        net: mctp: move expiry timer delete to unhash
        net: mctp: add an explicit reference from a mctp_sk_key to sock
        net: ravb: Fix possible hang if RIS2_QFF1 happen
        net: ravb: Fix lack of register setting after system resumed for Gen3
        net/x25: Fix to not accept on connected socket
        ice: move devlink port creation/deletion
        sctp: fail if no bound addresses can be used for a given scope
        net/sched: sch_taprio: do not schedule in taprio_reset()
        Revert "Merge branch 'ethtool-mac-merge'"
        netrom: Fix use-after-free of a listening socket.
        netfilter: conntrack: unify established states for SCTP paths
        Revert "netfilter: conntrack: add sctp DATA_SENT state"
        netfilter: conntrack: fix bug in for_each_sctp_chunk
        netfilter: conntrack: fix vtag checks for ABORT/SHUTDOWN_COMPLETE
        ...
      28b4387f
    • Linus Torvalds's avatar
      treewide: fix up files incorrectly marked executable · 262b42e0
      Linus Torvalds authored
      I'm not exactly clear on what strange workflow causes people to do it,
      but clearly occasionally some files end up being committed as executable
      even though they clearly aren't.
      
      This is a reprise of commit 90fda63f
      
       ("treewide: fix up files
      incorrectly marked executable"), just with a different set of files (but
      with the same trivial shell scripting).
      
      So apparently we need to re-do this every five years or so, and Joe
      needs to just keep reminding me to do so ;)
      
      Reported-by: default avatarJoe Perches <joe@perches.com>
      Fixes: 523375c9 ("drm/vmwgfx: Port vmwgfx to arm64")
      Fixes: 5c439937
      
       ("ASoC: codecs: add support for ES8326")
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      262b42e0
  3. Jan 26, 2023
  4. Jan 25, 2023
    • David S. Miller's avatar
      Merge branch 'mptcp-fixes' · ac8d986c
      David S. Miller authored
      
      
      Jeremy Kerr says:
      
      ====================
      net: mctp: struct sock lifetime fixes
      
      This series is a set of fixes for the sock lifetime handling in the
      AF_MCTP code, fixing a uaf reported by Noam Rathaus
      <noamr@ssd-disclosure.com>.
      
      The Fixes: tags indicate the original patches affected, but some
      tweaking to backport to those commits may be needed; I have a separate
      branch with backports to 5.15 if that helps with stable trees.
      
      Of course, any comments/queries most welcome.
      ====================
      
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ac8d986c
    • Jeremy Kerr's avatar
      net: mctp: mark socks as dead on unhash, prevent re-add · b98e1a04
      Jeremy Kerr authored
      Once a socket has been unhashed, we want to prevent it from being
      re-used in a sk_key entry as part of a routing operation.
      
      This change marks the sk as SOCK_DEAD on unhash, which prevents addition
      into the net's key list.
      
      We need to do this during the key add path, rather than key lookup, as
      we release the net keys_lock between those operations.
      
      Fixes: 4a992bbd
      
       ("mctp: Implement message fragmentation & reassembly")
      Signed-off-by: default avatarJeremy Kerr <jk@codeconstruct.com.au>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b98e1a04
    • Paolo Abeni's avatar
      net: mctp: hold key reference when looking up a general key · 6e54ea37
      Paolo Abeni authored
      
      
      Currently, we have a race where we look up a sock through a "general"
      (ie, not directly associated with the (src,dest,tag) tuple) key, then
      drop the key reference while still holding the key's sock.
      
      This change expands the key reference until we've finished using the
      sock, and hence the sock reference too.
      
      Commit message changes from Jeremy Kerr <jk@codeconstruct.com.au>.
      
      Reported-by: default avatarNoam Rathaus <noamr@ssd-disclosure.com>
      Fixes: 73c61845
      
       ("mctp: locking, lifetime and validity changes for sk_keys")
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarJeremy Kerr <jk@codeconstruct.com.au>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      6e54ea37
    • Jeremy Kerr's avatar
      net: mctp: move expiry timer delete to unhash · 5f41ae6f
      Jeremy Kerr authored
      Currently, we delete the key expiry timer (in sk->close) before
      unhashing the sk. This means that another thread may find the sk through
      its presence on the key list, and re-queue the timer.
      
      This change moves the timer deletion to the unhash, after we have made
      the key no longer observable, so the timer cannot be re-queued.
      
      Fixes: 7b14e15a
      
       ("mctp: Implement a timeout for tags")
      Signed-off-by: default avatarJeremy Kerr <jk@codeconstruct.com.au>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      5f41ae6f
    • Jeremy Kerr's avatar
      net: mctp: add an explicit reference from a mctp_sk_key to sock · de8a6b15
      Jeremy Kerr authored
      Currently, we correlate the mctp_sk_key lifetime to the sock lifetime
      through the sock hash/unhash operations, but this is pretty tenuous, and
      there are cases where we may have a temporary reference to an unhashed
      sk.
      
      This change makes the reference more explicit, by adding a hold on the
      sock when it's associated with a mctp_sk_key, released on final key
      unref.
      
      Fixes: 73c61845
      
       ("mctp: locking, lifetime and validity changes for sk_keys")
      Signed-off-by: default avatarJeremy Kerr <jk@codeconstruct.com.au>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      de8a6b15
    • David S. Miller's avatar
      Merge branch 'ravb-fixes' · a9e9b78d
      David S. Miller authored
      Yoshihiro Shimoda says:
      
      ====================
      net: ravb: Fix potential issues
      
      Fix potentiall issues on the ravb driver.
      
      Changes from v2:
      https://lore.kernel.org/all/20230123131331.1425648-1-yoshihiro.shimoda.uh@renesas.com/
       - Add Reviewed-by in the patch [2/2].
       - Add a commit description in the patch [2/2].
      
      Changes from v1:
      https://lore.kernel.org/all/20230119043920.875280-1-yoshihiro.shimoda.uh@renesas.com/
      
      
       - Fix typo in the patch [1/2].
       - Add Reviewed-by in the patch [1/2].
       - Fix "Fixed" tag in the patch [2/2].
       - Fix a comment indentation of the code in the patch [2/2].
      ====================
      
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a9e9b78d
    • Yoshihiro Shimoda's avatar
      net: ravb: Fix possible hang if RIS2_QFF1 happen · f3c07758
      Yoshihiro Shimoda authored
      Since this driver enables the interrupt by RIC2_QFE1, this driver
      should clear the interrupt flag if it happens. Otherwise, the interrupt
      causes to hang the system.
      
      Note that this also fix a minor coding style (a comment indentation)
      around the fixed code.
      
      Fixes: c156633f
      
       ("Renesas Ethernet AVB driver proper")
      Signed-off-by: default avatarYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
      Reviewed-by: default avatarSergey Shtylyov <s.shtylyov@omp.ru>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f3c07758
    • Yoshihiro Shimoda's avatar
      net: ravb: Fix lack of register setting after system resumed for Gen3 · c2b6cdee
      Yoshihiro Shimoda authored
      After system entered Suspend to RAM, registers setting of this
      hardware is reset because the SoC will be turned off. On R-Car Gen3
      (info->ccc_gac), ravb_ptp_init() is called in ravb_probe() only. So,
      after system resumed, it lacks of the initial settings for ptp. So,
      add ravb_ptp_{init,stop}() into ravb_{resume,suspend}().
      
      Fixes: f5d7837f
      
       ("ravb: ptp: Add CONFIG mode support")
      Signed-off-by: default avatarYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
      Reviewed-by: default avatarSergey Shtylyov <s.shtylyov@omp.ru>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c2b6cdee
    • Hyunwoo Kim's avatar
      net/x25: Fix to not accept on connected socket · f2b0b521
      Hyunwoo Kim authored
      
      
      When listen() and accept() are called on an x25 socket
      that connect() succeeds, accept() succeeds immediately.
      This is because x25_connect() queues the skb to
      sk->sk_receive_queue, and x25_accept() dequeues it.
      
      This creates a child socket with the sk of the parent
      x25 socket, which can cause confusion.
      
      Fix x25_listen() to return -EINVAL if the socket has
      already been successfully connect()ed to avoid this issue.
      
      Signed-off-by: default avatarHyunwoo Kim <v4bel@theori.io>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f2b0b521
    • Jakub Kicinski's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf · 2a48216c
      Jakub Kicinski authored
      Pablo Neira Ayuso says:
      
      ====================
      Netfilter fixes for net
      
      1) Perform SCTP vtag verification for ABORT/SHUTDOWN_COMPLETE according
         to RFC 9260, Sect 8.5.1.
      
      2) Fix infinite loop if SCTP chunk size is zero in for_each_sctp_chunk().
         And remove useless check in this macro too.
      
      3) Revert DATA_SENT state in the SCTP tracker, this was applied in the
         previous merge window. Next patch in this series provides a more
         simple approach to multihoming support.
      
      4) Unify HEARTBEAT_ACKED and ESTABLISHED states for SCTP multihoming
         support, use default ESTABLISHED of 210 seconds based on
         heartbeat timeout * maximum number of retransmission + round-trip timeout.
         Otherwise, SCTP conntrack entry that represents secondary paths
         remain stale in the table for up to 5 days.
      
      This is a slightly large batch with fixes for the SCTP connection
      tracking helper, all patches from Sriram Yagnaraman.
      
      * git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf:
        netfilter: conntrack: unify established states for SCTP paths
        Revert "netfilter: conntrack: add sctp DATA_SENT state"
        netfilter: conntrack: fix bug in for_each_sctp_chunk
        netfilter: conntrack: fix vtag checks for ABORT/SHUTDOWN_COMPLETE
      ====================
      
      Link: https://lore.kernel.org/r/20230124183933.4752-1-pablo@netfilter.org
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      2a48216c
    • Paul M Stillwell Jr's avatar
      ice: move devlink port creation/deletion · 418e5340
      Paul M Stillwell Jr authored
      Commit a286ba73 ("ice: reorder PF/representor devlink
      port register/unregister flows") moved the code to create
      and destroy the devlink PF port. This was fine, but created
      a corner case issue in the case of ice_register_netdev()
      failing. In that case, the driver would end up calling
      ice_devlink_destroy_pf_port() twice.
      
      Additionally, it makes no sense to tie creation of the devlink
      PF port to the creation of the netdev so separate out the
      code to create/destroy the devlink PF port from the netdev
      code. This makes it a cleaner interface.
      
      Fixes: a286ba73
      
       ("ice: reorder PF/representor devlink port register/unregister flows")
      Signed-off-by: default avatarPaul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
      Tested-by: Gurucharan G <gurucharanx.g@intel.com> (A Contingent worker at Intel)
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      Reviewed-by: default avatarLeon Romanovsky <leonro@nvidia.com>
      Link: https://lore.kernel.org/r/20230124005714.3996270-1-anthony.l.nguyen@intel.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      418e5340
    • Marcelo Ricardo Leitner's avatar
      sctp: fail if no bound addresses can be used for a given scope · 458e279f
      Marcelo Ricardo Leitner authored
      
      
      Currently, if you bind the socket to something like:
              servaddr.sin6_family = AF_INET6;
              servaddr.sin6_port = htons(0);
              servaddr.sin6_scope_id = 0;
              inet_pton(AF_INET6, "::1", &servaddr.sin6_addr);
      
      And then request a connect to:
              connaddr.sin6_family = AF_INET6;
              connaddr.sin6_port = htons(20000);
              connaddr.sin6_scope_id = if_nametoindex("lo");
              inet_pton(AF_INET6, "fe88::1", &connaddr.sin6_addr);
      
      What the stack does is:
       - bind the socket
       - create a new asoc
       - to handle the connect
         - copy the addresses that can be used for the given scope
         - try to connect
      
      But the copy returns 0 addresses, and the effect is that it ends up
      trying to connect as if the socket wasn't bound, which is not the
      desired behavior. This unexpected behavior also allows KASLR leaks
      through SCTP diag interface.
      
      The fix here then is, if when trying to copy the addresses that can
      be used for the scope used in connect() it returns 0 addresses, bail
      out. This is what TCP does with a similar reproducer.
      
      Reported-by: default avatarPietro Borrello <borrello@diag.uniroma1.it>
      Fixes: 1da177e4
      
       ("Linux-2.6.12-rc2")
      Signed-off-by: default avatarMarcelo Ricardo Leitner <marcelo.leitner@gmail.com>
      Reviewed-by: default avatarXin Long <lucien.xin@gmail.com>
      Link: https://lore.kernel.org/r/9fcd182f1099f86c6661f3717f63712ddd1c676c.1674496737.git.marcelo.leitner@gmail.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      458e279f
    • Linus Torvalds's avatar
      Merge tag 'modules-6.2-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux · 948ef7bb
      Linus Torvalds authored
      Pull module fix from Luis Chamberlain:
       "Theis is a fix we have been delaying for v6.2 due to lack of early
        testing on linux-next.
      
        The commit has been sitting in linux-next since December and testing
        has also been now a bit extensive by a few developers. Since this is a
        fix which definitely will go to v6.3 it should also apply to v6.2 so
        if there are any issues we pick them up earlier rather than later. The
        fix fixes a regression since v5.3, prior to me helping with module
        maintenance, however, the issue is real in that in the worst case now
        can prevent boot.
      
        We've discussed all possible corner cases [0] and at last do feel this
        is ready for v6.2-rc6"
      
      Link https://lore.kernel.org/all/Y9A4fiobL6IHp%2F%2FP@bombadil.infradead.org/ [0]
      
      * tag 'modules-6.2-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux:
        module: Don't wait for GOING modules
      948ef7bb
    • Eric Dumazet's avatar
      net/sched: sch_taprio: do not schedule in taprio_reset() · ea4fdbaa
      Eric Dumazet authored
      As reported by syzbot and hinted by Vinicius, I should not have added
      a qdisc_synchronize() call in taprio_reset()
      
      taprio_reset() can be called with qdisc spinlock held (and BH disabled)
      as shown in included syzbot report [1].
      
      Only taprio_destroy() needed this synchronization, as explained
      in the blamed commit changelog.
      
      [1]
      
      BUG: scheduling while atomic: syz-executor150/5091/0x00000202
      2 locks held by syz-executor150/5091:
      Modules linked in:
      Preemption disabled at:
      [<0000000000000000>] 0x0
      Kernel panic - not syncing: scheduling while atomic: panic_on_warn set ...
      CPU: 1 PID: 5091 Comm: syz-executor150 Not tainted 6.2.0-rc3-syzkaller-00219-g010a74f52203 #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/12/2023
      Call Trace:
      <TASK>
      __dump_stack lib/dump_stack.c:88 [inline]
      dump_stack_lvl+0xd1/0x138 lib/dump_stack.c:106
      panic+0x2cc/0x626 kernel/panic.c:318
      check_panic_on_warn.cold+0x19/0x35 kernel/panic.c:238
      __schedule_bug.cold+0xd5/0xfe kernel/sched/core.c:5836
      schedule_debug kernel/sched/core.c:5865 [inline]
      __schedule+0x34e4/0x5450 kernel/sched/core.c:6500
      schedule+0xde/0x1b0 kernel/sched/core.c:6682
      schedule_timeout+0x14e/0x2a0 kernel/time/timer.c:2167
      schedule_timeout_uninterruptible kernel/time/timer.c:2201 [inline]
      msleep+0xb6/0x100 kernel/time/timer.c:2322
      qdisc_synchronize include/net/sch_generic.h:1295 [inline]
      taprio_reset+0x93/0x270 net/sched/sch_taprio.c:1703
      qdisc_reset+0x10c/0x770 net/sched/sch_generic.c:1022
      dev_reset_queue+0x92/0x130 net/sched/sch_generic.c:1285
      netdev_for_each_tx_queue include/linux/netdevice.h:2464 [inline]
      dev_deactivate_many+0x36d/0x9f0 net/sched/sch_generic.c:1351
      dev_deactivate+0xed/0x1b0 net/sched/sch_generic.c:1374
      qdisc_graft+0xe4a/0x1380 net/sched/sch_api.c:1080
      tc_modify_qdisc+0xb6b/0x19a0 net/sched/sch_api.c:1689
      rtnetlink_rcv_msg+0x43e/0xca0 net/core/rtnetlink.c:6141
      netlink_rcv_skb+0x165/0x440 net/netlink/af_netlink.c:2564
      netlink_unicast_kernel net/netlink/af_netlink.c:1330 [inline]
      netlink_unicast+0x547/0x7f0 net/netlink/af_netlink.c:1356
      netlink_sendmsg+0x91b/0xe10 net/netlink/af_netlink.c:1932
      sock_sendmsg_nosec net/socket.c:714 [inline]
      sock_sendmsg+0xd3/0x120 net/socket.c:734
      ____sys_sendmsg+0x712/0x8c0 net/socket.c:2476
      ___sys_sendmsg+0x110/0x1b0 net/socket.c:2530
      __sys_sendmsg+0xf7/0x1c0 net/socket.c:2559
      do_syscall_x64 arch/x86/entry/common.c:50 [inline]
      
      Fixes: 3a415d59 ("net/sched: sch_taprio: fix possible use-after-free")
      Link: https://lore.kernel.org/netdev/167387581653.2747.13878941339893288655.git-patchwork-notify@kernel.org/T/
      
      
      Reported-by: default avatarsyzbot <syzkaller@googlegroups.com>
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Cc: Vinicius Costa Gomes <vinicius.gomes@intel.com>
      Link: https://lore.kernel.org/r/20230123084552.574396-1-edumazet@google.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      ea4fdbaa
    • Linus Torvalds's avatar
      Merge tag 'rust-fixes-6.2' of https://github.com/Rust-for-Linux/linux · 246dc53f
      Linus Torvalds authored
      Pull rust fix from Miguel Ojeda:
      
       - Avoid evaluating arguments in 'pr_*' macros in 'unsafe' blocks
      
      * tag 'rust-fixes-6.2' of https://github.com/Rust-for-Linux/linux:
        rust: print: avoid evaluating arguments in `pr_*` macros in `unsafe` blocks
      246dc53f
    • Linus Torvalds's avatar
      Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm · b2f31717
      Linus Torvalds authored
      Pull kvm fixes from Paolo Bonzini:
       "ARM64:
      
         - Pass the correct address to mte_clear_page_tags() on initialising a
           tagged page
      
         - Plug a race against a GICv4.1 doorbell interrupt while saving the
           vgic-v3 pending state.
      
        x86:
      
         - A command line parsing fix and a clang compilation fix for
           selftests
      
         - A fix for a longstanding VMX issue, that surprisingly was only
           found now to affect real world guests"
      
      * tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm:
        KVM: selftests: Make reclaim_period_ms input always be positive
        KVM: x86/vmx: Do not skip segment attributes if unusable bit is set
        selftests: kvm: move declaration at the beginning of main()
        KVM: arm64: GICv4.1: Fix race with doorbell on VPE activation/deactivation
        KVM: arm64: Pass the actual page address to mte_clear_page_tags()
      b2f31717
    • Linus Torvalds's avatar
      Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi · 02db81a7
      Linus Torvalds authored
      Pull SCSI fixes from James Bottomley:
       "Six fixes, all in drivers.
      
        The biggest are the UFS devfreq fixes which address a lock inversion
        and the two iscsi_tcp fixes which try to prevent a use after free from
        userspace still accessing an area which the kernel has released (seen
        by KASAN)"
      
      * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
        scsi: device_handler: alua: Remove a might_sleep() annotation
        scsi: iscsi_tcp: Fix UAF during login when accessing the shost ipaddress
        scsi: iscsi_tcp: Fix UAF during logout when accessing the shost ipaddress
        scsi: ufs: core: Fix devfreq deadlocks
        scsi: hpsa: Fix allocation size for scsi_host_alloc()
        scsi: target: core: Fix warning on RT kernels
      02db81a7
    • Linus Torvalds's avatar
      Merge tag 'nfsd-6.2-5' of git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux · fb6e71db
      Linus Torvalds authored
      Pull nfsd fix from Chuck Lever:
      
       - Nail another UAF in NFSD's filecache
      
      * tag 'nfsd-6.2-5' of git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux:
        nfsd: don't free files unconditionally in __nfsd_file_cache_purge
      fb6e71db
    • Linus Torvalds's avatar
      Merge tag 'fscrypt-for-linus' of git://git.kernel.org/pub/scm/fs/fscrypt/linux · 50306df3
      Linus Torvalds authored
      Pull fscrypt MAINTAINERS entry update from Eric Biggers:
       "Update the MAINTAINERS file entry for fscrypt"
      
      * tag 'fscrypt-for-linus' of git://git.kernel.org/pub/scm/fs/fscrypt/linux:
        MAINTAINERS: update fscrypt git repo
      50306df3
    • Petr Pavlu's avatar
      module: Don't wait for GOING modules · 0254127a
      Petr Pavlu authored
      During a system boot, it can happen that the kernel receives a burst of
      requests to insert the same module but loading it eventually fails
      during its init call. For instance, udev can make a request to insert
      a frequency module for each individual CPU when another frequency module
      is already loaded which causes the init function of the new module to
      return an error.
      
      Since commit 6e6de3de ("kernel/module.c: Only return -EEXIST for
      modules that have finished loading"), the kernel waits for modules in
      MODULE_STATE_GOING state to finish unloading before making another
      attempt to load the same module.
      
      This creates unnecessary work in the described scenario and delays the
      boot. In the worst case, it can prevent udev from loading drivers for
      other devices and might cause timeouts of services waiting on them and
      subsequently a failed boot.
      
      This patch attempts a different solution for the problem 6e6de3de
      was trying to solve. Rather than waiting for the unloading to complete,
      it returns a different error code (-EBUSY) for modules in the GOING
      state. This should avoid the error situation that was described in
      6e6de3de (user space attempting to load a dependent module because
      the -EEXIST error code would suggest to user space that the first module
      had been loaded successfully), while avoiding the delay situation too.
      
      This has been tested on linux-next since December 2022 and passes
      all kmod selftests except test 0009 with module compression enabled
      but it has been confirmed that this issue has existed and has gone
      unnoticed since prior to this commit and can also be reproduced without
      module compression with a simple usleep(5000000) on tools/modprobe.c [0].
      These failures are caused by hitting the kernel mod_concurrent_max and can
      happen either due to a self inflicted kernel module auto-loead DoS somehow
      or on a system with large CPU count and each CPU count incorrectly triggering
      many module auto-loads. Both of those issues need to be fixed in-kernel.
      
      [0] https://lore.kernel.org/all/Y9A4fiobL6IHp%2F%2FP@bombadil.infradead.org/
      
      Fixes: 6e6de3de
      
       ("kernel/module.c: Only return -EEXIST for modules that have finished loading")
      Co-developed-by: default avatarMartin Wilck <mwilck@suse.com>
      Signed-off-by: default avatarMartin Wilck <mwilck@suse.com>
      Signed-off-by: default avatarPetr Pavlu <petr.pavlu@suse.com>
      Cc: stable@vger.kernel.org
      Reviewed-by: default avatarPetr Mladek <pmladek@suse.com>
      [mcgrof: enhance commit log with testing and kmod test result interpretation ]
      Signed-off-by: default avatarLuis Chamberlain <mcgrof@kernel.org>
      0254127a
    • Linus Torvalds's avatar
      Merge tag 'fsverity-for-linus' of git://git.kernel.org/pub/scm/fs/fsverity/linux · 5149394c
      Linus Torvalds authored
      Pull fsverity MAINTAINERS entry update from Eric Biggers:
       "Update the MAINTAINERS file entry for fsverity"
      
      * tag 'fsverity-for-linus' of git://git.kernel.org/pub/scm/fs/fsverity/linux:
        MAINTAINERS: update fsverity git repo, list, and patchwork
      5149394c
    • Linus Torvalds's avatar
      ext4: make xattr char unsignedness in hash explicit · 854f0912
      Linus Torvalds authored
      Commit f3bbac32
      
       ("ext4: deal with legacy signed xattr name hash
      values") added a hashing function for the legacy case of having the
      xattr hash calculated using a signed 'char' type.  It left the unsigned
      case alone, since it's all implicitly handled by the '-funsigned-char'
      compiler option.
      
      However, there's been some noise about back-porting it all into stable
      kernels that lack the '-funsigned-char', so let's just make that at
      least possible by making the whole 'this uses unsigned char' very
      explicit in the code itself.  Whether such a back-port is really
      warranted or not, I'll leave to others, but at least together with this
      change it is technically sensible.
      
      Also, add a 'pr_warn_once()' for reporting the "hey, signedness for this
      hash calculation has changed" issue.  Hopefully it never triggers except
      for that xfstests generic/454 test-case, but even if it does it's just
      good information to have.
      
      If for no other reason than "we can remove the legacy signed hash code
      entirely if nobody ever sees the message any more".
      
      Cc: Sasha Levin <sashal@kernel.org>
      Cc: Eric Biggers <ebiggers@kernel.org>
      Cc: Andreas Dilger <adilger@dilger.ca>
      Cc: Theodore Ts'o <tytso@mit.edu>,
      Cc: Jason Donenfeld <Jason@zx2c4.com>
      Cc: Masahiro Yamada <masahiroy@kernel.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      854f0912
    • Paolo Abeni's avatar
      Revert "Merge branch 'ethtool-mac-merge'" · d968117a
      Paolo Abeni authored
      This reverts commit 0ad999c1, reversing
      changes made to e38553bd
      
      .
      
      It was not intended for net.
      
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      d968117a
  5. Jan 24, 2023
    • Christian Brauner's avatar
      fuse: fixes after adapting to new posix acl api · facd6105
      Christian Brauner authored
      This cycle we ported all filesystems to the new posix acl api. While
      looking at further simplifications in this area to remove the last
      remnants of the generic dummy posix acl handlers we realized that we
      regressed fuse daemons that don't set FUSE_POSIX_ACL but still make use
      of posix acls.
      
      With the change to a dedicated posix acl api interacting with posix acls
      doesn't go through the old xattr codepaths anymore and instead only
      relies the get acl and set acl inode operations.
      
      Before this change fuse daemons that don't set FUSE_POSIX_ACL were able
      to get and set posix acl albeit with two caveats. First, that posix acls
      aren't cached. And second, that they aren't used for permission checking
      in the vfs.
      
      We regressed that use-case as we currently refuse to retrieve any posix
      acls if they aren't enabled via FUSE_POSIX_ACL. So older fuse daemons
      would see a change in behavior.
      
      We can restore the old behavior in multiple ways. We could change the
      new posix acl api and look for a dedicated xattr handler and if we find
      one prefer that over the dedicated posix acl api. That would break the
      consistency of the new posix acl api so we would very much prefer not to
      do that.
      
      We could introduce a new ACL_*_CACHE sentinel that would instruct the
      vfs permission checking codepath to not call into the filesystem and
      ignore acls.
      
      But a more straightforward fix for v6.2 is to do the same thing that
      Overlayfs does and give fuse a separate get acl method for permission
      checking. Overlayfs uses this to express different needs for vfs
      permission lookup and acl based retrieval via the regular system call
      path as well. Let fuse do the same for now. This way fuse can continue
      to refuse to retrieve posix acls for daemons that don't set
      FUSE_POSXI_ACL for permission checking while allowing a fuse server to
      retrieve it via the usual system calls.
      
      In the future, we could extend the get acl inode operation to not just
      pass a simple boolean to indicate rcu lookup but instead make it a flag
      argument. Then in addition to passing the information that this is an
      rcu lookup to the filesystem we could also introduce a flag that tells
      the filesystem that this is a request from the vfs to use these acls for
      permission checking. Then fuse could refuse the get acl request for
      permission checking when the daemon doesn't have FUSE_POSIX_ACL set in
      the same get acl method. This would also help Overlayfs and allow us to
      remove the second method for it as well.
      
      But since that change is more invasive as we need to update the get acl
      inode operation for multiple filesystems we should not do this as a fix
      for v6.2. Instead we will do this for the v6.3 merge window.
      
      Fwiw, since posix acls are now always correctly translated in the new
      posix acl api we could also allow them to be used for daemons without
      FUSE_POSIX_ACL that are not mounted on the host. But this is behavioral
      change and again if dones should be done for v6.3. For now, let's just
      restore the original behavior.
      
      A nice side-effect of this change is that for fuse daemons with and
      without FUSE_POSIX_ACL the same code is used for posix acls in a
      backwards compatible way. This also means we can remove the legacy xattr
      handlers completely. We've also added comments to explain the expected
      behavior for daemons without FUSE_POSIX_ACL into the code.
      
      Fixes: 318e6685
      
       ("xattr: use posix acl api")
      Signed-off-by: default avatarSeth Forshee (Digital Ocean) <sforshee@kernel.org>
      Reviewed-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
      Signed-off-by: default avatarChristian Brauner (Microsoft) <brauner@kernel.org>
      facd6105
    • Kuniyuki Iwashima's avatar
      netrom: Fix use-after-free of a listening socket. · 409db27e
      Kuniyuki Iwashima authored
      syzbot reported a use-after-free in do_accept(), precisely nr_accept()
      as sk_prot_alloc() allocated the memory and sock_put() frees it. [0]
      
      The issue could happen if the heartbeat timer is fired and
      nr_heartbeat_expiry() calls nr_destroy_socket(), where a socket
      has SOCK_DESTROY or a listening socket has SOCK_DEAD.
      
      In this case, the first condition cannot be true.  SOCK_DESTROY is
      flagged in nr_release() only when the file descriptor is close()d,
      but accept() is being called for the listening socket, so the second
      condition must be true.
      
      Usually, the AF_NETROM listener neither starts timers nor sets
      SOCK_DEAD.  However, the condition is met if connect() fails before
      listen().  connect() starts the t1 timer and heartbeat timer, and
      t1timer calls nr_disconnect() when timeout happens.  Then, SOCK_DEAD
      is set, and if we call listen(), the heartbeat timer calls
      nr_destroy_socket().
      
        nr_connect
          nr_establish_data_link(sk)
            nr_start_t1timer(sk)
          nr_start_heartbeat(sk)
                                          nr_t1timer_expiry
                                            nr_disconnect(sk, ETIMEDOUT)
                                              nr_sk(sk)->state = NR_STATE_0
                                              sk->sk_state = TCP_CLOSE
                                              sock_set_flag(sk, SOCK_DEAD)
      nr_listen
        if (sk->sk_state != TCP_LISTEN)
          sk->sk_state = TCP_LISTEN
                                          nr_heartbeat_expiry
                                            switch (nr->state)
                                            case NR_STATE_0
                                              if (sk->sk_state == TCP_LISTEN &&
                                                  sock_flag(sk, SOCK_DEAD))
                                                nr_destroy_socket(sk)
      
      This path seems expected, and nr_destroy_socket() is called to clean
      up resources.  Initially, there was sock_hold() before nr_destroy_socket()
      so that the socket would not be freed, but the commit 517a16b1
      ("netrom: Decrease sock refcount when sock timers expire") accidentally
      removed it.
      
      To fix use-after-free, let's add sock_hold().
      
      [0]:
      BUG: KASAN: use-after-free in do_accept+0x483/0x510 net/socket.c:1848
      Read of size 8 at addr ffff88807978d398 by task syz-executor.3/5315
      
      CPU: 0 PID: 5315 Comm: syz-executor.3 Not tainted 6.2.0-rc3-syzkaller-00165-gd9fc1511728c #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022
      Call Trace:
       <TASK>
       __dump_stack lib/dump_stack.c:88 [inline]
       dump_stack_lvl+0xd1/0x138 lib/dump_stack.c:106
       print_address_description mm/kasan/report.c:306 [inline]
       print_report+0x15e/0x461 mm/kasan/report.c:417
       kasan_report+0xbf/0x1f0 mm/kasan/report.c:517
       do_accept+0x483/0x510 net/socket.c:1848
       __sys_accept4_file net/socket.c:1897 [inline]
       __sys_accept4+0x9a/0x120 net/socket.c:1927
       __do_sys_accept net/socket.c:1944 [inline]
       __se_sys_accept net/socket.c:1941 [inline]
       __x64_sys_accept+0x75/0xb0 net/socket.c:1941
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x63/0xcd
      RIP: 0033:0x7fa436a8c0c9
      Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 19 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48
      RSP: 002b:00007fa437784168 EFLAGS: 00000246 ORIG_RAX: 000000000000002b
      RAX: ffffffffffffffda RBX: 00007fa436bac050 RCX: 00007fa436a8c0c9
      RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000005
      RBP: 00007fa436ae7ae9 R08: 0000000000000000 R09: 0000000000000000
      R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
      R13: 00007ffebc6700df R14: 00007fa437784300 R15: 0000000000022000
       </TASK>
      
      Allocated by task 5294:
       kasan_save_stack+0x22/0x40 mm/kasan/common.c:45
       kasan_set_track+0x25/0x30 mm/kasan/common.c:52
       ____kasan_kmalloc mm/kasan/common.c:371 [inline]
       ____kasan_kmalloc mm/kasan/common.c:330 [inline]
       __kasan_kmalloc+0xa3/0xb0 mm/kasan/common.c:380
       kasan_kmalloc include/linux/kasan.h:211 [inline]
       __do_kmalloc_node mm/slab_common.c:968 [inline]
       __kmalloc+0x5a/0xd0 mm/slab_common.c:981
       kmalloc include/linux/slab.h:584 [inline]
       sk_prot_alloc+0x140/0x290 net/core/sock.c:2038
       sk_alloc+0x3a/0x7a0 net/core/sock.c:2091
       nr_create+0xb6/0x5f0 net/netrom/af_netrom.c:433
       __sock_create+0x359/0x790 net/socket.c:1515
       sock_create net/socket.c:1566 [inline]
       __sys_socket_create net/socket.c:1603 [inline]
       __sys_socket_create net/socket.c:1588 [inline]
       __sys_socket+0x133/0x250 net/socket.c:1636
       __do_sys_socket net/socket.c:1649 [inline]
       __se_sys_socket net/socket.c:1647 [inline]
       __x64_sys_socket+0x73/0xb0 net/socket.c:1647
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x63/0xcd
      
      Freed by task 14:
       kasan_save_stack+0x22/0x40 mm/kasan/common.c:45
       kasan_set_track+0x25/0x30 mm/kasan/common.c:52
       kasan_save_free_info+0x2b/0x40 mm/kasan/generic.c:518
       ____kasan_slab_free mm/kasan/common.c:236 [inline]
       ____kasan_slab_free+0x13b/0x1a0 mm/kasan/common.c:200
       kasan_slab_free include/linux/kasan.h:177 [inline]
       __cache_free mm/slab.c:3394 [inline]
       __do_kmem_cache_free mm/slab.c:3580 [inline]
       __kmem_cache_free+0xcd/0x3b0 mm/slab.c:3587
       sk_prot_free net/core/sock.c:2074 [inline]
       __sk_destruct+0x5df/0x750 net/core/sock.c:2166
       sk_destruct net/core/sock.c:2181 [inline]
       __sk_free+0x175/0x460 net/core/sock.c:2192
       sk_free+0x7c/0xa0 net/core/sock.c:2203
       sock_put include/net/sock.h:1991 [inline]
       nr_heartbeat_expiry+0x1d7/0x460 net/netrom/nr_timer.c:148
       call_timer_fn+0x1da/0x7c0 kernel/time/timer.c:1700
       expire_timers+0x2c6/0x5c0 kernel/time/timer.c:1751
       __run_timers kernel/time/timer.c:2022 [inline]
       __run_timers kernel/time/timer.c:1995 [inline]
       run_timer_softirq+0x326/0x910 kernel/time/timer.c:2035
       __do_softirq+0x1fb/0xadc kernel/softirq.c:571
      
      Fixes: 517a16b1
      
       ("netrom: Decrease sock refcount when sock timers expire")
      Reported-by: default avatar <syzbot+5fafd5cfe1fc91f6b352@syzkaller.appspotmail.com>
      Signed-off-by: default avatarKuniyuki Iwashima <kuniyu@amazon.com>
      Link: https://lore.kernel.org/r/20230120231927.51711-1-kuniyu@amazon.com
      
      
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      409db27e