Skip to content
  1. Aug 26, 2023
    • Helge Deller's avatar
      lib/clz_ctz.c: Fix __clzdi2() and __ctzdi2() for 32-bit kernels · 382d4cd1
      Helge Deller authored
      
      
      The gcc compiler translates on some architectures the 64-bit
      __builtin_clzll() function to a call to the libgcc function __clzdi2(),
      which should take a 64-bit parameter on 32- and 64-bit platforms.
      
      But in the current kernel code, the built-in __clzdi2() function is
      defined to operate (wrongly) on 32-bit parameters if BITS_PER_LONG ==
      32, thus the return values on 32-bit kernels are in the range from
      [0..31] instead of the expected [0..63] range.
      
      This patch fixes the in-kernel functions __clzdi2() and __ctzdi2() to
      take a 64-bit parameter on 32-bit kernels as well, thus it makes the
      functions identical for 32- and 64-bit kernels.
      
      This bug went unnoticed since kernel 3.11 for over 10 years, and here
      are some possible reasons for that:
      
       a) Some architectures have assembly instructions to count the bits and
          which are used instead of calling __clzdi2(), e.g. on x86 the bsr
          instruction and on ppc cntlz is used. On such architectures the
          wrong __clzdi2() implementation isn't used and as such the bug has
          no effect and won't be noticed.
      
       b) Some architectures link to libgcc.a, and the in-kernel weak
          functions get replaced by the correct 64-bit variants from libgcc.a.
      
       c) __builtin_clzll() and __clzdi2() doesn't seem to be used in many
          places in the kernel, and most likely only in uncritical functions,
          e.g. when printing hex values via seq_put_hex_ll(). The wrong return
          value will still print the correct number, but just in a wrong
          formatting (e.g. with too many leading zeroes).
      
       d) 32-bit kernels aren't used that much any longer, so they are less
          tested.
      
      A trivial testcase to verify if the currently running 32-bit kernel is
      affected by the bug is to look at the output of /proc/self/maps:
      
      Here the kernel uses a correct implementation of __clzdi2():
      
        root@debian:~# cat /proc/self/maps
        00010000-00019000 r-xp 00000000 08:05 787324     /usr/bin/cat
        00019000-0001a000 rwxp 00009000 08:05 787324     /usr/bin/cat
        0001a000-0003b000 rwxp 00000000 00:00 0          [heap]
        f7551000-f770d000 r-xp 00000000 08:05 794765     /usr/lib/hppa-linux-gnu/libc.so.6
        ...
      
      and this kernel uses the broken implementation of __clzdi2():
      
        root@debian:~# cat /proc/self/maps
        0000000010000-0000000019000 r-xp 00000000 000000008:000000005 787324  /usr/bin/cat
        0000000019000-000000001a000 rwxp 000000009000 000000008:000000005 787324  /usr/bin/cat
        000000001a000-000000003b000 rwxp 00000000 00:00 0  [heap]
        00000000f73d1000-00000000f758d000 r-xp 00000000 000000008:000000005 794765  /usr/lib/hppa-linux-gnu/libc.so.6
        ...
      
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      Fixes: 4df87bb7 ("lib: add weak clz/ctz functions")
      Cc: Chanho Min <chanho.min@lge.com>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Cc: stable@vger.kernel.org # v3.11+
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      382d4cd1
    • Linus Torvalds's avatar
      Merge tag 'mm-hotfixes-stable-2023-08-25-11-07' of... · 6f0edbb8
      Linus Torvalds authored
      Merge tag 'mm-hotfixes-stable-2023-08-25-11-07' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
      
      Pull misc fixes from Andrew Morton:
       "18 hotfixes. 13 are cc:stable and the remainder pertain to post-6.4
        issues or aren't considered suitable for a -stable backport"
      
      * tag 'mm-hotfixes-stable-2023-08-25-11-07' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm:
        shmem: fix smaps BUG sleeping while atomic
        selftests: cachestat: catch failing fsync test on tmpfs
        selftests: cachestat: test for cachestat availability
        maple_tree: disable mas_wr_append() when other readers are possible
        madvise:madvise_free_pte_range(): don't use mapcount() against large folio for sharing check
        madvise:madvise_free_huge_pmd(): don't use mapcount() against large folio for sharing check
        madvise:madvise_cold_or_pageout_pte_range(): don't use mapcount() against large folio for sharing check
        mm: multi-gen LRU: don't spin during memcg release
        mm: memory-failure: fix unexpected return value in soft_offline_page()
        radix tree: remove unused variable
        mm: add a call to flush_cache_vmap() in vmap_pfn()
        selftests/mm: FOLL_LONGTERM need to be updated to 0x100
        nilfs2: fix general protection fault in nilfs_lookup_dirty_data_buffers()
        mm/gup: handle cont-PTE hugetlb pages correctly in gup_must_unshare() via GUP-fast
        selftests: cgroup: fix test_kmem_basic less than error
        mm: enable page walking API to lock vmas during the walk
        smaps: use vm_normal_page_pmd() instead of follow_trans_huge_pmd()
        mm/gup: reintroduce FOLL_NUMA as FOLL_HONOR_NUMA_FAULT
      6f0edbb8
    • Linus Torvalds's avatar
      Merge tag 'riscv-for-linus-6.5-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux · 4942fed8
      Linus Torvalds authored
      Pull RISC-V fixes from Palmer Dabbelt:
       "This is obviously not ideal, particularly for something this late in
        the cycle.
      
        Unfortunately we found some uABI issues in the vector support while
        reviewing the GDB port, which has triggered a revert -- probably a
        good sign we should have reviewed GDB before merging this, I guess I
        just dropped the ball because I was so worried about the context
        extension and libc suff I forgot. Hence the late revert.
      
        There's some risk here as we're still exposing the vector context for
        signal handlers, but changing that would have meant reverting all of
        the vector support. The issues we've found so far have been fixed
        already and they weren't absolute showstoppers, so we're essentially
        just playing it safe by holding ptrace support for another release (or
        until we get through a proper userspace code review).
      
        Summary:
      
         - The vector ucontext extension has been extended with vlenb
      
         - The vector registers ELF core dump note type has been changed to
           avoid aliasing with the CSR type used in embedded systems
      
         - Support for accessing vector registers via ptrace() has been
           reverted
      
         - Another build fix for the ISA spec changes around Zifencei/Zicsr
           that manifests on some systems built with binutils-2.37 and
           gcc-11.2"
      
      * tag 'riscv-for-linus-6.5-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux:
        riscv: Fix build errors using binutils2.37 toolchains
        RISC-V: vector: export VLENB csr in __sc_riscv_v_state
        RISC-V: Remove ptrace support for vectors
      4942fed8
    • Linus Torvalds's avatar
      Merge tag 'gpio-fixes-for-v6.5' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux · 98c6b8a5
      Linus Torvalds authored
      Pull gpio fixes from Bartosz Golaszewski:
      
       - fix an irq mapping leak in gpio-sim
      
       - associate the GPIO device's software node with the irq domain in
         gpio-sim
      
      * tag 'gpio-fixes-for-v6.5' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux:
        gpio: sim: pass the GPIO device's software node to irq domain
        gpio: sim: dispose of irq mappings before destroying the irq_sim domain
      98c6b8a5
    • Linus Torvalds's avatar
      Merge tag 'pinctrl-v6.5-4' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl · a87eaffb
      Linus Torvalds authored
      Pull pin control fixes from Linus Walleij:
       "Here are some Renesas and AMD driver fixes, the AMD fix affects
        important laptops in the wild so this one is pretty important. It
        seems a bit tough to get this right.
      
         - Fix DT parsing and related locking in the Renesas driver.
      
         - Fix wakeup IRQs in the AMD driver once again. Really tricky this
           one"
      
      * tag 'pinctrl-v6.5-4' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl:
        pinctrl: amd: Mask wake bits on probe again
        pinctrl: renesas: rza2: Add lock around pinctrl_generic{{add,remove}_group,{add,remove}_function}
        pinctrl: renesas: rzv2m: Fix NULL pointer dereference in rzv2m_dt_subnode_to_map()
        pinctrl: renesas: rzg2l: Fix NULL pointer dereference in rzg2l_dt_subnode_to_map()
      a87eaffb
  2. Aug 25, 2023
  3. Aug 24, 2023
    • Linus Torvalds's avatar
      Merge tag 'net-6.5-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net · b5cc3833
      Linus Torvalds authored
      Pull networking fixes from Paolo Abeni:
       "Including fixes from wifi, can and netfilter.
      
        Fixes to fixes:
      
         - nf_tables:
             - GC transaction race with abort path
             - defer gc run if previous batch is still pending
      
        Previous releases - regressions:
      
         - ipv4: fix data-races around inet->inet_id
      
         - phy: fix deadlocking in phy_error() invocation
      
         - mdio: fix C45 read/write protocol
      
         - ipvlan: fix a reference count leak warning in ipvlan_ns_exit()
      
         - ice: fix NULL pointer deref during VF reset
      
         - i40e: fix potential NULL pointer dereferencing of pf->vf in
           i40e_sync_vsi_filters()
      
         - tg3: use slab_build_skb() when needed
      
         - mtk_eth_soc: fix NULL pointer on hw reset
      
        Previous releases - always broken:
      
         - core: validate veth and vxcan peer ifindexes
      
         - sched: fix a qdisc modification with ambiguous command request
      
         - devlink: add missing unregister linecard notification
      
         - wifi: mac80211: limit reorder_buf_filtered to avoid UBSAN warning
      
         - batman:
            - do not get eth header before batadv_check_management_packet
            - fix batadv_v_ogm_aggr_send memory leak
      
         - bonding: fix macvlan over alb bond support
      
         - mlxsw: set time stamp fields also when its type is MIRROR_UTC"
      
      * tag 'net-6.5-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (54 commits)
        selftests: bonding: add macvlan over bond testing
        selftest: bond: add new topo bond_topo_2d1c.sh
        bonding: fix macvlan over alb bond support
        rtnetlink: Reject negative ifindexes in RTM_NEWLINK
        netfilter: nf_tables: defer gc run if previous batch is still pending
        netfilter: nf_tables: fix out of memory error handling
        netfilter: nf_tables: use correct lock to protect gc_list
        netfilter: nf_tables: GC transaction race with abort path
        netfilter: nf_tables: flush pending destroy work before netlink notifier
        netfilter: nf_tables: validate all pending tables
        ibmveth: Use dcbf rather than dcbfl
        i40e: fix potential NULL pointer dereferencing of pf->vf i40e_sync_vsi_filters()
        net/sched: fix a qdisc modification with ambiguous command request
        igc: Fix the typo in the PTM Control macro
        batman-adv: Hold rtnl lock during MTU update via netlink
        igb: Avoid starting unnecessary workqueues
        can: raw: add missing refcount for memory leak fix
        can: isotp: fix support for transmission of SF without flow control
        bnx2x: new flag for track HW resource allocation
        sfc: allocate a big enough SKB for loopback selftest packet
        ...
      b5cc3833
    • Chuck Lever's avatar
      NFSD: Fix a thinko introduced by recent trace point changes · 8073a98e
      Chuck Lever authored
      
      
      The fixed commit erroneously removed a call to nfsd_end_grace(),
      which makes calls to write_v4_end_grace() a no-op.
      
      Reported-by: default avatarkernel test robot <oliver.sang@intel.com>
      Closes: https://lore.kernel.org/oe-lkp/202308241229.68396422-oliver.sang@intel.com
      
      
      Fixes: 39d432fc ("NFSD: trace nfsctl operations")
      Reviewed-by: default avatarJeff Layton <jlayton@kernel.org>
      Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
      8073a98e
    • Mario Limonciello's avatar
      ASoC: amd: yc: Fix a non-functional mic on Lenovo 82SJ · c008323f
      Mario Limonciello authored
      
      
      Lenovo 82SJ doesn't have DMIC connected like 82V2 does.  Narrow
      the match down to only cover 82V2.
      
      Reported-by: default avatar <prosenfeld@Yuhsbstudents.org>
      Closes: https://bugzilla.kernel.org/show_bug.cgi?id=217063
      
      
      Fixes: 2232b2dd ("ASoC: amd: yc: Add Lenovo Yoga Slim 7 Pro X to quirks table")
      Signed-off-by: default avatarMario Limonciello <mario.limonciello@amd.com>
      Link: https://lore.kernel.org/r/20230824011149.1395-1-mario.limonciello@amd.com
      
      
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      c008323f
    • Paolo Abeni's avatar
      Merge tag 'nf-23-08-23' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/netfilter/nf · 8938fc0c
      Paolo Abeni authored
      Florian Westphal says:
      
      ====================
      netfilter updates for net
      
      This PR contains nf_tables updates for your *net* tree.
      
      First patch fixes table validation, I broke this in 6.4 when tracking
      validation state per table, reported by Pablo, fixup from myself.
      
      Second patch makes sure objects waiting for memory release have been
      released, this was broken in 6.1, patch from Pablo Neira Ayuso.
      
      Patch three is a fix-for-fix from previous PR: In case a transaction
      gets aborted, gc sequence counter needs to be incremented so pending
      gc requests are invalidated, from Pablo.
      
      Same for patch 4: gc list needs to use gc list lock, not destroy lock,
      also from Pablo.
      
      Patch 5 fixes a UaF in a set backend, but this should only occur when
      failslab is enabled for GFP_KERNEL allocations, broken since feature
      was added in 5.6, from myself.
      
      Patch 6 fixes a double-free bug that was also added via previous PR:
      We must not schedule gc work if the previous batch is still queued.
      
      netfilter pull request 2023-08-23
      
      * tag 'nf-23-08-23' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/netfilter/nf:
        netfilter: nf_tables: defer gc run if previous batch is still pending
        netfilter: nf_tables: fix out of memory error handling
        netfilter: nf_tables: use correct lock to protect gc_list
        netfilter: nf_tables: GC transaction race with abort path
        netfilter: nf_tables: flush pending destroy work before netlink notifier
        netfilter: nf_tables: validate all pending tables
      ====================
      
      Link: https://lore.kernel.org/r/20230823152711.15279-1-fw@strlen.de
      
      
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      8938fc0c
    • Paolo Abeni's avatar
      Merge branch 'fix-macvlan-over-alb-bond-support' · b251610c
      Paolo Abeni authored
      Hangbin Liu says:
      
      ====================
      fix macvlan over alb bond support
      
      Currently, the macvlan over alb bond is broken after commit
      14af9963 ("bonding: Support macvlans on top of tlb/rlb mode bonds").
      Fix this and add relate tests.
      ====================
      
      Link: https://lore.kernel.org/r/20230823071907.3027782-1-liuhangbin@gmail.com
      
      
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      b251610c
    • Hangbin Liu's avatar
      selftests: bonding: add macvlan over bond testing · 246af950
      Hangbin Liu authored
      
      
      Add a macvlan over bonding test with mode active-backup, balance-tlb
      and balance-alb.
      
      ]# ./bond_macvlan.sh
      TEST: active-backup: IPv4: client->server                           [ OK ]
      TEST: active-backup: IPv6: client->server                           [ OK ]
      TEST: active-backup: IPv4: client->macvlan_1                        [ OK ]
      TEST: active-backup: IPv6: client->macvlan_1                        [ OK ]
      TEST: active-backup: IPv4: client->macvlan_2                        [ OK ]
      TEST: active-backup: IPv6: client->macvlan_2                        [ OK ]
      TEST: active-backup: IPv4: macvlan_1->macvlan_2                     [ OK ]
      TEST: active-backup: IPv6: macvlan_1->macvlan_2                     [ OK ]
      TEST: active-backup: IPv4: server->client                           [ OK ]
      TEST: active-backup: IPv6: server->client                           [ OK ]
      TEST: active-backup: IPv4: macvlan_1->client                        [ OK ]
      TEST: active-backup: IPv6: macvlan_1->client                        [ OK ]
      TEST: active-backup: IPv4: macvlan_2->client                        [ OK ]
      TEST: active-backup: IPv6: macvlan_2->client                        [ OK ]
      TEST: active-backup: IPv4: macvlan_2->macvlan_2                     [ OK ]
      TEST: active-backup: IPv6: macvlan_2->macvlan_2                     [ OK ]
      [...]
      TEST: balance-alb: IPv4: client->server                             [ OK ]
      TEST: balance-alb: IPv6: client->server                             [ OK ]
      TEST: balance-alb: IPv4: client->macvlan_1                          [ OK ]
      TEST: balance-alb: IPv6: client->macvlan_1                          [ OK ]
      TEST: balance-alb: IPv4: client->macvlan_2                          [ OK ]
      TEST: balance-alb: IPv6: client->macvlan_2                          [ OK ]
      TEST: balance-alb: IPv4: macvlan_1->macvlan_2                       [ OK ]
      TEST: balance-alb: IPv6: macvlan_1->macvlan_2                       [ OK ]
      TEST: balance-alb: IPv4: server->client                             [ OK ]
      TEST: balance-alb: IPv6: server->client                             [ OK ]
      TEST: balance-alb: IPv4: macvlan_1->client                          [ OK ]
      TEST: balance-alb: IPv6: macvlan_1->client                          [ OK ]
      TEST: balance-alb: IPv4: macvlan_2->client                          [ OK ]
      TEST: balance-alb: IPv6: macvlan_2->client                          [ OK ]
      TEST: balance-alb: IPv4: macvlan_2->macvlan_2                       [ OK ]
      TEST: balance-alb: IPv6: macvlan_2->macvlan_2                       [ OK ]
      
      Signed-off-by: default avatarHangbin Liu <liuhangbin@gmail.com>
      Acked-by: default avatarJay Vosburgh <jay.vosburgh@canonical.com>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      246af950
    • Hangbin Liu's avatar
      selftest: bond: add new topo bond_topo_2d1c.sh · 27aa43f8
      Hangbin Liu authored
      
      
      Add a new testing topo bond_topo_2d1c.sh which is used more commonly.
      Make bond_topo_3d1c.sh just source bond_topo_2d1c.sh and add the
      extra link.
      
      Signed-off-by: default avatarHangbin Liu <liuhangbin@gmail.com>
      Acked-by: default avatarJay Vosburgh <jay.vosburgh@canonical.com>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      27aa43f8
    • Hangbin Liu's avatar
      bonding: fix macvlan over alb bond support · e74216b8
      Hangbin Liu authored
      
      
      The commit 14af9963 ("bonding: Support macvlans on top of tlb/rlb mode
      bonds") aims to enable the use of macvlans on top of rlb bond mode. However,
      the current rlb bond mode only handles ARP packets to update remote neighbor
      entries. This causes an issue when a macvlan is on top of the bond, and
      remote devices send packets to the macvlan using the bond's MAC address
      as the destination. After delivering the packets to the macvlan, the macvlan
      will rejects them as the MAC address is incorrect. Consequently, this commit
      makes macvlan over bond non-functional.
      
      To address this problem, one potential solution is to check for the presence
      of a macvlan port on the bond device using netif_is_macvlan_port(bond->dev)
      and return NULL in the rlb_arp_xmit() function. However, this approach
      doesn't fully resolve the situation when a VLAN exists between the bond and
      macvlan.
      
      So let's just do a partial revert for commit 14af9963 in rlb_arp_xmit().
      As the comment said, Don't modify or load balance ARPs that do not originate
      locally.
      
      Fixes: 14af9963 ("bonding: Support macvlans on top of tlb/rlb mode bonds")
      Reported-by: default avatar <susan.zheng@veritas.com>
      Closes: https://bugzilla.redhat.com/show_bug.cgi?id=2117816
      
      
      Signed-off-by: default avatarHangbin Liu <liuhangbin@gmail.com>
      Acked-by: default avatarJay Vosburgh <jay.vosburgh@canonical.com>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      e74216b8
    • Ido Schimmel's avatar
      rtnetlink: Reject negative ifindexes in RTM_NEWLINK · 30188bd7
      Ido Schimmel authored
      
      
      Negative ifindexes are illegal, but the kernel does not validate the
      ifindex in the ancillary header of RTM_NEWLINK messages, resulting in
      the kernel generating a warning [1] when such an ifindex is specified.
      
      Fix by rejecting negative ifindexes.
      
      [1]
      WARNING: CPU: 0 PID: 5031 at net/core/dev.c:9593 dev_index_reserve+0x1a2/0x1c0 net/core/dev.c:9593
      [...]
      Call Trace:
       <TASK>
       register_netdevice+0x69a/0x1490 net/core/dev.c:10081
       br_dev_newlink+0x27/0x110 net/bridge/br_netlink.c:1552
       rtnl_newlink_create net/core/rtnetlink.c:3471 [inline]
       __rtnl_newlink+0x115e/0x18c0 net/core/rtnetlink.c:3688
       rtnl_newlink+0x67/0xa0 net/core/rtnetlink.c:3701
       rtnetlink_rcv_msg+0x439/0xd30 net/core/rtnetlink.c:6427
       netlink_rcv_skb+0x16b/0x440 net/netlink/af_netlink.c:2545
       netlink_unicast_kernel net/netlink/af_netlink.c:1342 [inline]
       netlink_unicast+0x536/0x810 net/netlink/af_netlink.c:1368
       netlink_sendmsg+0x93c/0xe40 net/netlink/af_netlink.c:1910
       sock_sendmsg_nosec net/socket.c:728 [inline]
       sock_sendmsg+0xd9/0x180 net/socket.c:751
       ____sys_sendmsg+0x6ac/0x940 net/socket.c:2538
       ___sys_sendmsg+0x135/0x1d0 net/socket.c:2592
       __sys_sendmsg+0x117/0x1e0 net/socket.c:2621
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x63/0xcd
      
      Fixes: 38f7b870 ("[RTNETLINK]: Link creation API")
      Reported-by: default avatar <syzbot+5ba06978f34abb058571@syzkaller.appspotmail.com>
      Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Reviewed-by: default avatarJiri Pirko <jiri@nvidia.com>
      Reviewed-by: default avatarJakub Kicinski <kuba@kernel.org>
      Link: https://lore.kernel.org/r/20230823064348.2252280-1-idosch@nvidia.com
      
      
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      30188bd7
    • Takashi Iwai's avatar
      Merge tag 'asoc-fix-v6.5-rc7' of... · a4a6eed8
      Takashi Iwai authored
      Merge tag 'asoc-fix-v6.5-rc7' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus
      
      ASoC: Fixes for v6.5
      
      A relatively large but generally not super urgent set of fixes for ASoC,
      including some quirks and a MAINTAINERS update.  There's also an update
      to cs35l56 to change the firmware ABI, there are no current shipping
      systems which use the current interface and the sooner we get the new
      interface in the less likely it is that something will start.
      
      It'd be nice if these landed for v6.5 but not the end of the world if
      they wait till v6.6.
      a4a6eed8
    • Linus Torvalds's avatar
      Merge tag 'acpi-6.5-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm · 93f5de5f
      Linus Torvalds authored
      Pull ACPI fix from Rafael Wysocki:
       "Make an existing ACPI IRQ override quirk for PCSpecialist Elimina Pro
        16 M work as intended (Hans de Goede)"
      
      * tag 'acpi-6.5-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
        ACPI: resource: Fix IRQ override quirk for PCSpecialist Elimina Pro 16 M
      93f5de5f
    • Imre Deak's avatar
      drm/i915: Fix HPD polling, reenabling the output poll work as needed · 1dcc4374
      Imre Deak authored
      
      
      After the commit in the Fixes: line below, HPD polling stopped working
      on i915, since after that change calling drm_kms_helper_poll_enable()
      doesn't restart drm_mode_config::output_poll_work if the work was
      stopped (no connectors needing polling) and enabling polling for a
      connector (during runtime suspend or detecting an HPD IRQ storm).
      
      After the above change calling drm_kms_helper_poll_enable() is a nop
      after it's been called already and polling for some connectors was
      disabled/re-enabled.
      
      Fix this by calling drm_kms_helper_poll_reschedule() added in the
      previous patch instead, which reschedules the work whenever expected.
      
      Fixes: d33a54e3 ("drm/probe_helper: sort out poll_running vs poll_enabled")
      CC: stable@vger.kernel.org # 6.4+
      Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
      Cc: dri-devel@lists.freedesktop.org
      Reviewed-by: default avatarJouni Högander <jouni.hogander@intel.com>
      Signed-off-by: default avatarImre Deak <imre.deak@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20230822113015.41224-2-imre.deak@intel.com
      
      
      (cherry picked from commit 50452f2f)
      Signed-off-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
      1dcc4374
    • Imre Deak's avatar
      drm: Add an HPD poll helper to reschedule the poll work · a94e7ccf
      Imre Deak authored
      
      
      Add a helper to reschedule drm_mode_config::output_poll_work after
      polling has been enabled for a connector (and needing a reschedule,
      since previously polling was disabled for all connectors and hence
      output_poll_work was not running).
      
      This is needed by the next patch fixing HPD polling on i915.
      
      CC: stable@vger.kernel.org # 6.4+
      Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
      Cc: dri-devel@lists.freedesktop.org
      Reviewed-by: default avatarJouni Högander <jouni.hogander@intel.com>
      Reviewed-by: default avatarDmitry Baryshkov <dmitry.baryshkov@linaro.org>
      Signed-off-by: default avatarImre Deak <imre.deak@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20230822113015.41224-1-imre.deak@intel.com
      
      
      (cherry picked from commit fe2352fd)
      Signed-off-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
      a94e7ccf
    • Palmer Dabbelt's avatar
      Merge patch series "riscv: fix ptrace and export VLENB" · e2de1646
      Palmer Dabbelt authored
      Andy Chiu <andy.chiu@sifive.com> says:
      
      We add a vlenb field in Vector context and save it with the
      riscv_vstate_save() macro. It should not cause performance regression as
      VLENB is a design-time constant and is frequently used by hardware.
      Also, adding this field into the __sc_riscv_v_state may benifit us on a
      future compatibility issue becuse a hardware may have writable VLENB.
      
      Adding and saving VLENB have an immediate benifit as it gives ptrace a
      better view of the Vector extension and makes it possible to reconstruct
      Vector register files from the dump without doing an additional csr read.
      
      This patchset also sync the number of note types between us and gdb for
      riscv to solve a conflicting note.
      
      This is not an ABI break given that 6.5 has not been released yet.
      
      * b4-shazam-merge:
        RISC-V: vector: export VLENB csr in __sc_riscv_v_state
        RISC-V: Remove ptrace support for vectors
      
      Link: https://lore.kernel.org/r/20230816155450.26200-1-andy.chiu@sifive.com
      
      
      Signed-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
      e2de1646
    • Bartosz Golaszewski's avatar
      gpio: sim: pass the GPIO device's software node to irq domain · 6e39c1ac
      Bartosz Golaszewski authored
      
      
      Associate the swnode of the GPIO device's (which is the interrupt
      controller here) with the irq domain. Otherwise the interrupt-controller
      device attribute is a no-op.
      
      Fixes: cb8c474e ("gpio: sim: new testing module")
      Signed-off-by: default avatarBartosz Golaszewski <bartosz.golaszewski@linaro.org>
      Reviewed-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      6e39c1ac
    • Bartosz Golaszewski's avatar
      gpio: sim: dispose of irq mappings before destroying the irq_sim domain · ab4109f9
      Bartosz Golaszewski authored
      
      
      If a GPIO simulator device is unbound with interrupts still requested,
      we will hit a use-after-free issue in __irq_domain_deactivate_irq(). The
      owner of the irq domain must dispose of all mappings before destroying
      the domain object.
      
      Fixes: cb8c474e ("gpio: sim: new testing module")
      Signed-off-by: default avatarBartosz Golaszewski <bartosz.golaszewski@linaro.org>
      Reviewed-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      ab4109f9
    • Zack Rusin's avatar
      drm/vmwgfx: Fix possible invalid drm gem put calls · f9e96bf1
      Zack Rusin authored
      
      
      vmw_bo_unreference sets the input buffer to null on exit, resulting in
      null ptr deref's on the subsequent drm gem put calls.
      
      This went unnoticed because only very old userspace would be exercising
      those paths but it wouldn't be hard to hit on old distros with brand
      new kernels.
      
      Introduce a new function that abstracts unrefing of user bo's to make
      the code cleaner and more explicit.
      
      Signed-off-by: default avatarZack Rusin <zackr@vmware.com>
      Reported-by: default avatarIan Forbes <iforbes@vmware.com>
      Fixes: 9ef8d83e ("drm/vmwgfx: Do not drop the reference to the handle too soon")
      Cc: <stable@vger.kernel.org> # v6.4+
      Reviewed-by: default avatarMaaz <Mombasawala&lt;mombasawalam@vmware.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20230818041301.407636-1-zack@kde.org
      f9e96bf1
    • Zack Rusin's avatar
      drm/vmwgfx: Fix shader stage validation · 14abdfae
      Zack Rusin authored
      
      
      For multiple commands the driver was not correctly validating the shader
      stages resulting in possible kernel oopses. The validation code was only.
      if ever, checking the upper bound on the shader stages but never a lower
      bound (valid shader stages start at 1 not 0).
      
      Fixes kernel oopses ending up in vmw_binding_add, e.g.:
      Oops: 0000 [#1] PREEMPT SMP PTI
      CPU: 1 PID: 2443 Comm: testcase Not tainted 6.3.0-rc4-vmwgfx #1
      Hardware name: VMware, Inc. VMware Virtual Platform/440BX Desktop Reference Platform, BIOS 6.00 11/12/2020
      RIP: 0010:vmw_binding_add+0x4c/0x140 [vmwgfx]
      Code: 7e 30 49 83 ff 0e 0f 87 ea 00 00 00 4b 8d 04 7f 89 d2 89 cb 48 c1 e0 03 4c 8b b0 40 3d 93 c0 48 8b 80 48 3d 93 c0 49 0f af de <48> 03 1c d0 4c 01 e3 49 8>
      RSP: 0018:ffffb8014416b968 EFLAGS: 00010206
      RAX: ffffffffc0933ec0 RBX: 0000000000000000 RCX: 0000000000000000
      RDX: 00000000ffffffff RSI: ffffb8014416b9c0 RDI: ffffb8014316f000
      RBP: ffffb8014416b998 R08: 0000000000000003 R09: 746f6c735f726564
      R10: ffffffffaaf2bda0 R11: 732e676e69646e69 R12: ffffb8014316f000
      R13: ffffb8014416b9c0 R14: 0000000000000040 R15: 0000000000000006
      FS:  00007fba8c0af740(0000) GS:ffff8a1277c80000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 00000007c0933eb8 CR3: 0000000118244001 CR4: 00000000003706e0
      Call Trace:
       <TASK>
       vmw_view_bindings_add+0xf5/0x1b0 [vmwgfx]
       ? ___drm_dbg+0x8a/0xb0 [drm]
       vmw_cmd_dx_set_shader_res+0x8f/0xc0 [vmwgfx]
       vmw_execbuf_process+0x590/0x1360 [vmwgfx]
       vmw_execbuf_ioctl+0x173/0x370 [vmwgfx]
       ? __drm_dev_dbg+0xb4/0xe0 [drm]
       ? __pfx_vmw_execbuf_ioctl+0x10/0x10 [vmwgfx]
       drm_ioctl_kernel+0xbc/0x160 [drm]
       drm_ioctl+0x2d2/0x580 [drm]
       ? __pfx_vmw_execbuf_ioctl+0x10/0x10 [vmwgfx]
       ? do_fault+0x1a6/0x420
       vmw_generic_ioctl+0xbd/0x180 [vmwgfx]
       vmw_unlocked_ioctl+0x19/0x20 [vmwgfx]
       __x64_sys_ioctl+0x96/0xd0
       do_syscall_64+0x5d/0x90
       ? handle_mm_fault+0xe4/0x2f0
       ? debug_smp_processor_id+0x1b/0x30
       ? fpregs_assert_state_consistent+0x2e/0x50
       ? exit_to_user_mode_prepare+0x40/0x180
       ? irqentry_exit_to_user_mode+0xd/0x20
       ? irqentry_exit+0x3f/0x50
       ? exc_page_fault+0x8b/0x180
       entry_SYSCALL_64_after_hwframe+0x72/0xdc
      
      Signed-off-by: default avatarZack Rusin <zackr@vmware.com>
      Cc: security@openanolis.org
      Reported-by: default avatarZiming Zhang <ezrakiez@gmail.com>
      Testcase-found-by: default avatarNiels De Graef <ndegraef@redhat.com>
      Fixes: d80efd5c ("drm/vmwgfx: Initial DX support")
      Cc: <stable@vger.kernel.org> # v4.3+
      Reviewed-by: default avatarMaaz <Mombasawala&lt;mombasawalam@vmware.com>
      Reviewed-by: default avatarMartin Krastev <krastevm@vmware.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20230616190934.54828-1-zack@kde.org
      14abdfae