Skip to content
  1. Jul 27, 2023
    • Andrzej Hajda's avatar
      drm/i915/perf: add sentinel to xehp_oa_b_counters · 21d92025
      Andrzej Hajda authored
      [ Upstream commit 785b3f66 ]
      
      Arrays passed to reg_in_range_table should end with empty record.
      
      The patch solves KASAN detected bug with signature:
      BUG: KASAN: global-out-of-bounds in xehp_is_valid_b_counter_addr+0x2c7/0x350 [i915]
      Read of size 4 at addr ffffffffa1555d90 by task perf/1518
      
      CPU: 4 PID: 1518 Comm: perf Tainted: G U 6.4.0-kasan_438-g3303d06107f3+ #1
      Hardware name: Intel Corporation Meteor Lake Client Platform/MTL-P DDR5 SODIMM SBS RVP, BIOS MTLPFWI1.R00.3223.D80.2305311348 05/31/2023
      Call Trace:
      <TASK>
      ...
      xehp_is_valid_b_counter_addr+0x2c7/0x350 [i915]
      
      Fixes: 0fa9349d
      
       ("drm/i915/perf: complete programming whitelisting for XEHPSDV")
      Signed-off-by: default avatarAndrzej Hajda <andrzej.hajda@intel.com>
      Reviewed-by: default avatarAndi Shyti <andi.shyti@linux.intel.com>
      Reviewed-by: default avatarNirmoy Das <nirmoy.das@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20230711153410.1224997-1-andrzej.hajda@intel.com
      (cherry picked from commit 2f42c5af
      
      )
      Signed-off-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      21d92025
    • Heiner Kallweit's avatar
      r8169: fix ASPM-related problem for chip version 42 and 43 · 899057ac
      Heiner Kallweit authored
      [ Upstream commit 162d626f ]
      
      Referenced commit missed that for chip versions 42 and 43 ASPM
      remained disabled in the respective rtl_hw_start_...() routines.
      This resulted in problems as described in the referenced bug
      ticket. Therefore re-instantiate the previous logic.
      
      Fixes: 5fc3f6c9
      
       ("r8169: consolidate disabling ASPM before EPHY access")
      Closes: https://bugzilla.kernel.org/show_bug.cgi?id=217635
      Signed-off-by: default avatarHeiner Kallweit <hkallweit1@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      899057ac
    • Tristram Ha's avatar
      net: dsa: microchip: correct KSZ8795 static MAC table access · 024825df
      Tristram Ha authored
      [ Upstream commit 4bdf79d6 ]
      
      The KSZ8795 driver code was modified to use on KSZ8863/73, which has
      different register definitions.  Some of the new KSZ8795 register
      information are wrong compared to previous code.
      
      KSZ8795 also behaves differently in that the STATIC_MAC_TABLE_USE_FID
      and STATIC_MAC_TABLE_FID bits are off by 1 when doing MAC table reading
      than writing.  To compensate that a special code was added to shift the
      register value by 1 before applying those bits.  This is wrong when the
      code is running on KSZ8863, so this special code is only executed when
      KSZ8795 is detected.
      
      Fixes: 4b20a07e
      
       ("net: dsa: microchip: ksz8795: add support for ksz88xx chips")
      Signed-off-by: default avatarTristram Ha <Tristram.Ha@microchip.com>
      Reviewed-by: default avatarHoratiu Vultur <horatiu.vultur@microchip.com>
      Reviewed-by: default avatarSimon Horman <simon.horman@corigine.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      024825df
    • Victor Nogueira's avatar
      net: sched: cls_bpf: Undo tcf_bind_filter in case of an error · 6777dfaf
      Victor Nogueira authored
      [ Upstream commit 26a22194 ]
      
      If cls_bpf_offload errors out, we must also undo tcf_bind_filter that
      was done before the error.
      
      Fix that by calling tcf_unbind_filter in errout_parms.
      
      Fixes: eadb4148
      
       ("net: cls_bpf: add support for marking filters as hardware-only")
      Signed-off-by: default avatarVictor Nogueira <victor@mojatatu.com>
      Acked-by: default avatarJamal Hadi Salim <jhs@mojatatu.com>
      Reviewed-by: default avatarPedro Tammela <pctammela@mojatatu.com>
      Reviewed-by: default avatarSimon Horman <simon.horman@corigine.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      6777dfaf
    • Victor Nogueira's avatar
      net: sched: cls_u32: Undo refcount decrement in case update failed · cec095b3
      Victor Nogueira authored
      [ Upstream commit e8d3d78c ]
      
      In the case of an update, when TCA_U32_LINK is set, u32_set_parms will
      decrement the refcount of the ht_down (struct tc_u_hnode) pointer
      present in the older u32 filter which we are replacing. However, if
      u32_replace_hw_knode errors out, the update command fails and that
      ht_down pointer continues decremented. To fix that, when
      u32_replace_hw_knode fails, check if ht_down's refcount was decremented
      and undo the decrement.
      
      Fixes: d34e3e18
      
       ("net: cls_u32: Add support for skip-sw flag to tc u32 classifier.")
      Signed-off-by: default avatarVictor Nogueira <victor@mojatatu.com>
      Acked-by: default avatarJamal Hadi Salim <jhs@mojatatu.com>
      Reviewed-by: default avatarPedro Tammela <pctammela@mojatatu.com>
      Reviewed-by: default avatarSimon Horman <simon.horman@corigine.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      cec095b3
    • Victor Nogueira's avatar
      net: sched: cls_u32: Undo tcf_bind_filter if u32_replace_hw_knode · 025159ed
      Victor Nogueira authored
      [ Upstream commit 9cb36fae ]
      
      When u32_replace_hw_knode fails, we need to undo the tcf_bind_filter
      operation done at u32_set_parms.
      
      Fixes: d34e3e18
      
       ("net: cls_u32: Add support for skip-sw flag to tc u32 classifier.")
      Signed-off-by: default avatarVictor Nogueira <victor@mojatatu.com>
      Acked-by: default avatarJamal Hadi Salim <jhs@mojatatu.com>
      Reviewed-by: default avatarPedro Tammela <pctammela@mojatatu.com>
      Reviewed-by: default avatarSimon Horman <simon.horman@corigine.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      025159ed
    • Victor Nogueira's avatar
      net: sched: cls_matchall: Undo tcf_bind_filter in case of failure after mall_set_parms · 1134ceab
      Victor Nogueira authored
      [ Upstream commit b3d0e048 ]
      
      In case an error occurred after mall_set_parms executed successfully, we
      must undo the tcf_bind_filter call it issues.
      
      Fix that by calling tcf_unbind_filter in err_replace_hw_filter label.
      
      Fixes: ec2507d2
      
       ("net/sched: cls_matchall: Fix error path")
      Signed-off-by: default avatarVictor Nogueira <victor@mojatatu.com>
      Acked-by: default avatarJamal Hadi Salim <jhs@mojatatu.com>
      Reviewed-by: default avatarPedro Tammela <pctammela@mojatatu.com>
      Reviewed-by: default avatarSimon Horman <simon.horman@corigine.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      1134ceab
    • Martin Fuzzey's avatar
      regulator: da9063: fix null pointer deref with partial DT config · 04a025b1
      Martin Fuzzey authored
      [ Upstream commit 98e2dd5f ]
      
      When some of the da9063 regulators do not have corresponding DT nodes
      a null pointer dereference occurs on boot because such regulators have
      no init_data causing the pointers calculated in
      da9063_check_xvp_constraints() to be invalid.
      
      Do not dereference them in this case.
      
      Fixes: b8717a80
      
       ("regulator: da9063: implement setter for voltage monitoring")
      Signed-off-by: default avatarMartin Fuzzey <martin.fuzzey@flowbird.group>
      Link: https://lore.kernel.org/r/20230616143736.2946173-1-martin.fuzzey@flowbird.group
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      04a025b1
    • Dan Carpenter's avatar
      ASoC: SOF: ipc3-dtrace: uninitialized data in dfsentry_trace_filter_write() · d9234856
      Dan Carpenter authored
      [ Upstream commit 469e2f28 ]
      
      This doesn't check how many bytes the simple_write_to_buffer() writes to
      the buffer.  The only thing that we know is that the first byte is
      initialized and the last byte of the buffer is set to NUL.  However
      the middle bytes could be uninitialized.
      
      There is no need to use simple_write_to_buffer().  This code does not
      support partial writes but instead passes "pos = 0" as the starting
      offset regardless of what the user passed as "*ppos".  Just use the
      copy_from_user() function and initialize the whole buffer.
      
      Fixes: 671e0b90
      
       ("ASoC: SOF: Clone the trace code to ipc3-dtrace as fw_tracing implementation")
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@linaro.org>
      Link: https://lore.kernel.org/r/74148292-ce4d-4e01-a1a7-921e6767da14@moroto.mountain
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      d9234856
    • Michal Swiatkowski's avatar
      ice: prevent NULL pointer deref during reload · ca03b327
      Michal Swiatkowski authored
      [ Upstream commit b3e7b3a6 ]
      
      Calling ethtool during reload can lead to call trace, because VSI isn't
      configured for some time, but netdev is alive.
      
      To fix it add rtnl lock for VSI deconfig and config. Set ::num_q_vectors
      to 0 after freeing and add a check for ::tx/rx_rings in ring related
      ethtool ops.
      
      Add proper unroll of filters in ice_start_eth().
      
      Reproduction:
      $watch -n 0.1 -d 'ethtool -g enp24s0f0np0'
      $devlink dev reload pci/0000:18:00.0 action driver_reinit
      
      Call trace before fix:
      [66303.926205] BUG: kernel NULL pointer dereference, address: 0000000000000000
      [66303.926259] #PF: supervisor read access in kernel mode
      [66303.926286] #PF: error_code(0x0000) - not-present page
      [66303.926311] PGD 0 P4D 0
      [66303.926332] Oops: 0000 [#1] PREEMPT SMP PTI
      [66303.926358] CPU: 4 PID: 933821 Comm: ethtool Kdump: loaded Tainted: G           OE      6.4.0-rc5+ #1
      [66303.926400] Hardware name: Intel Corporation S2600WFT/S2600WFT, BIOS SE5C620.86B.00.01.0014.070920180847 07/09/2018
      [66303.926446] RIP: 0010:ice_get_ringparam+0x22/0x50 [ice]
      [66303.926649] Code: 90 90 90 90 90 90 90 90 f3 0f 1e fa 0f 1f 44 00 00 48 8b 87 c0 09 00 00 c7 46 04 e0 1f 00 00 c7 46 10 e0 1f 00 00 48 8b 50 20 <48> 8b 12 0f b7 52 3a 89 56 14 48 8b 40 28 48 8b 00 0f b7 40 58 48
      [66303.926722] RSP: 0018:ffffad40472f39c8 EFLAGS: 00010246
      [66303.926749] RAX: ffff98a8ada05828 RBX: ffff98a8c46dd060 RCX: ffffad40472f3b48
      [66303.926781] RDX: 0000000000000000 RSI: ffff98a8c46dd068 RDI: ffff98a8b23c4000
      [66303.926811] RBP: ffffad40472f3b48 R08: 00000000000337b0 R09: 0000000000000000
      [66303.926843] R10: 0000000000000001 R11: 0000000000000100 R12: ffff98a8b23c4000
      [66303.926874] R13: ffff98a8c46dd060 R14: 000000000000000f R15: ffffad40472f3a50
      [66303.926906] FS:  00007f6397966740(0000) GS:ffff98b390900000(0000) knlGS:0000000000000000
      [66303.926941] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [66303.926967] CR2: 0000000000000000 CR3: 000000011ac20002 CR4: 00000000007706e0
      [66303.926999] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      [66303.927029] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      [66303.927060] PKRU: 55555554
      [66303.927075] Call Trace:
      [66303.927094]  <TASK>
      [66303.927111]  ? __die+0x23/0x70
      [66303.927140]  ? page_fault_oops+0x171/0x4e0
      [66303.927176]  ? exc_page_fault+0x7f/0x180
      [66303.927209]  ? asm_exc_page_fault+0x26/0x30
      [66303.927244]  ? ice_get_ringparam+0x22/0x50 [ice]
      [66303.927433]  rings_prepare_data+0x62/0x80
      [66303.927469]  ethnl_default_doit+0xe2/0x350
      [66303.927501]  genl_family_rcv_msg_doit.isra.0+0xe3/0x140
      [66303.927538]  genl_rcv_msg+0x1b1/0x2c0
      [66303.927561]  ? __pfx_ethnl_default_doit+0x10/0x10
      [66303.927590]  ? __pfx_genl_rcv_msg+0x10/0x10
      [66303.927615]  netlink_rcv_skb+0x58/0x110
      [66303.927644]  genl_rcv+0x28/0x40
      [66303.927665]  netlink_unicast+0x19e/0x290
      [66303.927691]  netlink_sendmsg+0x254/0x4d0
      [66303.927717]  sock_sendmsg+0x93/0xa0
      [66303.927743]  __sys_sendto+0x126/0x170
      [66303.927780]  __x64_sys_sendto+0x24/0x30
      [66303.928593]  do_syscall_64+0x5d/0x90
      [66303.929370]  ? __count_memcg_events+0x60/0xa0
      [66303.930146]  ? count_memcg_events.constprop.0+0x1a/0x30
      [66303.930920]  ? handle_mm_fault+0x9e/0x350
      [66303.931688]  ? do_user_addr_fault+0x258/0x740
      [66303.932452]  ? exc_page_fault+0x7f/0x180
      [66303.933193]  entry_SYSCALL_64_after_hwframe+0x72/0xdc
      
      Fixes: 5b246e53
      
       ("ice: split probe into smaller functions")
      Reviewed-by: default avatarPrzemek Kitszel <przemyslaw.kitszel@intel.com>
      Signed-off-by: default avatarMichal Swiatkowski <michal.swiatkowski@linux.intel.com>
      Reviewed-by: default avatarSimon Horman <simon.horman@corigine.com>
      Tested-by: Pucha Himasekhar Reddy <himasekharx.reddy.pucha@intel.com> (A Contingent worker at Intel)
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      ca03b327
    • Petr Oros's avatar
      ice: Unregister netdev and devlink_port only once · 9751240e
      Petr Oros authored
      [ Upstream commit 24a3298a ]
      
      Since commit 6624e780 ("ice: split ice_vsi_setup into smaller
      functions") ice_vsi_release does things twice. There is unregister
      netdev which is unregistered in ice_deinit_eth also.
      
      It also unregisters the devlink_port twice which is also unregistered
      in ice_deinit_eth(). This double deregistration is hidden because
      devl_port_unregister ignores the return value of xa_erase.
      
      [   68.642167] Call Trace:
      [   68.650385]  ice_devlink_destroy_pf_port+0xe/0x20 [ice]
      [   68.655656]  ice_vsi_release+0x445/0x690 [ice]
      [   68.660147]  ice_deinit+0x99/0x280 [ice]
      [   68.664117]  ice_remove+0x1b6/0x5c0 [ice]
      
      [  171.103841] Call Trace:
      [  171.109607]  ice_devlink_destroy_pf_port+0xf/0x20 [ice]
      [  171.114841]  ice_remove+0x158/0x270 [ice]
      [  171.118854]  pci_device_remove+0x3b/0xc0
      [  171.122779]  device_release_driver_internal+0xc7/0x170
      [  171.127912]  driver_detach+0x54/0x8c
      [  171.131491]  bus_remove_driver+0x77/0xd1
      [  171.135406]  pci_unregister_driver+0x2d/0xb0
      [  171.139670]  ice_module_exit+0xc/0x55f [ice]
      
      Fixes: 6624e780
      
       ("ice: split ice_vsi_setup into smaller functions")
      Signed-off-by: default avatarPetr Oros <poros@redhat.com>
      Reviewed-by: default avatarMaciej Fijalkowski <maciej.fijalkowski@intel.com>
      Tested-by: Pucha Himasekhar Reddy <himasekharx.reddy.pucha@intel.com> (A Contingent worker at Intel)
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      9751240e
    • Shyam Prasad N's avatar
      cifs: fix mid leak during reconnection after timeout threshold · 57d25e99
      Shyam Prasad N authored
      [ Upstream commit 69cba9d3 ]
      
      When the number of responses with status of STATUS_IO_TIMEOUT
      exceeds a specified threshold (NUM_STATUS_IO_TIMEOUT), we reconnect
      the connection. But we do not return the mid, or the credits
      returned for the mid, or reduce the number of in-flight requests.
      
      This bug could result in the server->in_flight count to go bad,
      and also cause a leak in the mids.
      
      This change moves the check to a few lines below where the
      response is decrypted, even of the response is read from the
      transform header. This way, the code for returning the mids
      can be reused.
      
      Also, the cifs_reconnect was reconnecting just the transport
      connection before. In case of multi-channel, this may not be
      what we want to do after several timeouts. Changed that to
      reconnect the session and the tree too.
      
      Also renamed NUM_STATUS_IO_TIMEOUT to a more appropriate name
      MAX_STATUS_IO_TIMEOUT.
      
      Fixes: 8e670f77
      
       ("Handle STATUS_IO_TIMEOUT gracefully")
      Signed-off-by: default avatarShyam Prasad N <sprasad@microsoft.com>
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      57d25e99
    • Dan Carpenter's avatar
      iommu/sva: Fix signedness bug in iommu_sva_alloc_pasid() · 9ee1fce2
      Dan Carpenter authored
      [ Upstream commit c20ecf7b ]
      
      The ida_alloc_range() function returns negative error codes on error.
      On success it returns values in the min to max range (inclusive).  It
      never returns more then INT_MAX even if "max" is higher.  It never
      returns values in the 0 to (min - 1) range.
      
      The bug is that "min" is an unsigned int so negative error codes will
      be promoted to high positive values errors treated as success.
      
      Fixes: 1a14bf0f
      
       ("iommu/sva: Use GFP_KERNEL for pasid allocation")
      Signed-off-by: default avatarDan Carpenter <error27@gmail.com>
      Reviewed-by: default avatarLu Baolu <baolu.lu@linux.intel.com>
      Link: https://lore.kernel.org/r/6b32095d-7491-4ebb-a850-12e96209eaaf@kili.mountain
      Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      9ee1fce2
    • Yan Zhai's avatar
      gso: fix dodgy bit handling for GSO_UDP_L4 · 52367a23
      Yan Zhai authored
      [ Upstream commit 98400367 ]
      
      Commit 1fd54773 ("udp: allow header check for dodgy GSO_UDP_L4
      packets.") checks DODGY bit for UDP, but for packets that can be fed
      directly to the device after gso_segs reset, it actually falls through
      to fragmentation:
      
      https://lore.kernel.org/all/CAJPywTKDdjtwkLVUW6LRA2FU912qcDmQOQGt2WaDo28KzYDg+A@mail.gmail.com/
      
      This change restores the expected behavior of GSO_UDP_L4 packets.
      
      Fixes: 1fd54773
      
       ("udp: allow header check for dodgy GSO_UDP_L4 packets.")
      Suggested-by: default avatarWillem de Bruijn <willemdebruijn.kernel@gmail.com>
      Signed-off-by: default avatarYan Zhai <yan@cloudflare.com>
      Reviewed-by: default avatarWillem de Bruijn <willemb@google.com>
      Acked-by: default avatarJason Wang <jasowang@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      52367a23
    • Daniel Golle's avatar
      net: ethernet: mtk_eth_soc: handle probe deferral · 2fffd179
      Daniel Golle authored
      [ Upstream commit 1d6d537d ]
      
      Move the call to of_get_ethdev_address to mtk_add_mac which is part of
      the probe function and can hence itself return -EPROBE_DEFER should
      of_get_ethdev_address return -EPROBE_DEFER. This allows us to entirely
      get rid of the mtk_init function.
      
      The problem of of_get_ethdev_address returning -EPROBE_DEFER surfaced
      in situations in which the NVMEM provider holding the MAC address has
      not yet be loaded at the time mtk_eth_soc is initially probed. In this
      case probing of mtk_eth_soc should be deferred instead of falling back
      to use a random MAC address, so once the NVMEM provider becomes
      available probing can be repeated.
      
      Fixes: 656e7052
      
       ("net-next: mediatek: add support for MT7623 ethernet")
      Signed-off-by: default avatarDaniel Golle <daniel@makrotopia.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      2fffd179
    • Kuniyuki Iwashima's avatar
      bridge: Add extack warning when enabling STP in netns. · d8415abc
      Kuniyuki Iwashima authored
      [ Upstream commit 56a16035 ]
      
      When we create an L2 loop on a bridge in netns, we will see packets storm
      even if STP is enabled.
      
        # unshare -n
        # ip link add br0 type bridge
        # ip link add veth0 type veth peer name veth1
        # ip link set veth0 master br0 up
        # ip link set veth1 master br0 up
        # ip link set br0 type bridge stp_state 1
        # ip link set br0 up
        # sleep 30
        # ip -s link show br0
        2: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
            link/ether b6:61:98:1c:1c:b5 brd ff:ff:ff:ff:ff:ff
            RX: bytes  packets  errors  dropped missed  mcast
            956553768  12861249 0       0       0       12861249  <-. Keep
            TX: bytes  packets  errors  dropped carrier collsns     |  increasing
            1027834    11951    0       0       0       0         <-'   rapidly
      
      This is because llc_rcv() drops all packets in non-root netns and BPDU
      is dropped.
      
      Let's add extack warning when enabling STP in netns.
      
        # unshare -n
        # ip link add br0 type bridge
        # ip link set br0 type bridge stp_state 1
        Warning: bridge: STP does not work in non-root netns.
      
      Note this commit will be reverted later when we namespacify the whole LLC
      infra.
      
      Fixes: e730c155
      
       ("[NET]: Make packet reception network namespace safe")
      Suggested-by: default avatarHarry Coin <hcoin@quietfountain.com>
      Link: https://lore.kernel.org/netdev/0f531295-e289-022d-5add-5ceffa0df9bc@quietfountain.com/
      Suggested-by: default avatarIdo Schimmel <idosch@idosch.org>
      Signed-off-by: default avatarKuniyuki Iwashima <kuniyu@amazon.com>
      Acked-by: default avatarNikolay Aleksandrov <razor@blackwall.org>
      Reviewed-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      d8415abc
    • Tanmay Patil's avatar
      net: ethernet: ti: cpsw_ale: Fix cpsw_ale_get_field()/cpsw_ale_set_field() · 92348447
      Tanmay Patil authored
      [ Upstream commit b685f1a5 ]
      
      CPSW ALE has 75 bit ALE entries which are stored within three 32 bit words.
      The cpsw_ale_get_field() and cpsw_ale_set_field() functions assume that the
      field will be strictly contained within one word. However, this is not
      guaranteed to be the case and it is possible for ALE field entries to span
      across up to two words at the most.
      
      Fix the methods to handle getting/setting fields spanning up to two words.
      
      Fixes: db82173f
      
       ("netdev: driver: ethernet: add cpsw address lookup engine support")
      Signed-off-by: default avatarTanmay Patil <t-patil@ti.com>
      [s-vadapalli@ti.com: rephrased commit message and added Fixes tag]
      Signed-off-by: default avatarSiddharth Vadapalli <s-vadapalli@ti.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      92348447
    • Linus Walleij's avatar
      dsa: mv88e6xxx: Do a final check before timing out · 445b3017
      Linus Walleij authored
      [ Upstream commit 95ce158b
      
       ]
      
      I get sporadic timeouts from the driver when using the
      MV88E6352. Reading the status again after the loop fixes the
      problem: the operation is successful but goes undetected.
      
      Some added prints show things like this:
      
      [   58.356209] mv88e6085 mdio_mux-0.1:00: Timeout while waiting
          for switch, addr 1b reg 0b, mask 8000, val 0000, data c000
      [   58.367487] mv88e6085 mdio_mux-0.1:00: Timeout waiting for
          ATU op 4000, fid 0001
      (...)
      [   61.826293] mv88e6085 mdio_mux-0.1:00: Timeout while waiting
          for switch, addr 1c reg 18, mask 8000, val 0000, data 9860
      [   61.837560] mv88e6085 mdio_mux-0.1:00: Timeout waiting
          for PHY command 1860 to complete
      
      The reason is probably not the commands: I think those are
      mostly fine with the 50+50ms timeout, but the problem
      appears when OpenWrt brings up several interfaces in
      parallel on a system with 7 populated ports: if one of
      them take more than 50 ms and waits one or more of the
      others can get stuck on the mutex for the switch and then
      this can easily multiply.
      
      As we sleep and wait, the function loop needs a final
      check after exiting the loop if we were successful.
      
      Suggested-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Cc: Tobias Waldekranz <tobias@waldekranz.com>
      Fixes: 35da1dfd
      
       ("net: dsa: mv88e6xxx: Improve performance of busy bit polling")
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Link: https://lore.kernel.org/r/20230712223405.861899-1-linus.walleij@linaro.org
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      445b3017
    • Marc Zyngier's avatar
      arm64: Fix HFGxTR_EL2 field naming · 05245970
      Marc Zyngier authored
      [ Upstream commit 55b87b74 ]
      
      The HFGxTR_EL2 fields do not always follow the naming described
      in the spec, nor do they match the name of the register they trap
      in the rest of the kernel.
      
      It is a bit sad that they were written by hand despite the availability
      of a machine readable version...
      
      Fixes: cc077e7f
      
       ("arm64/sysreg: Convert HFG[RW]TR_EL2 to automatic generation")
      Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
      Cc: Mark Brown <broonie@kernel.org>
      Cc: Will Deacon <will@kernel.org>
      Cc: Catalin Marinas <catalin.marinas@arm.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Reviewed-by: default avatarMark Brown <broonie@kernel.org>
      Link: https://lore.kernel.org/r/20230703130416.1495307-1-maz@kernel.org
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      05245970
    • Paulo Alcantara's avatar
      smb: client: fix missed ses refcounting · eb382196
      Paulo Alcantara authored
      [ Upstream commit bf99f6be ]
      
      Use new cifs_smb_ses_inc_refcount() helper to get an active reference
      of @ses and @ses->dfs_root_ses (if set).  This will prevent
      @ses->dfs_root_ses of being put in the next call to cifs_put_smb_ses()
      and thus potentially causing an use-after-free bug.
      
      Fixes: 8e355415
      
       ("cifs: fix sharing of DFS connections")
      Signed-off-by: default avatarPaulo Alcantara (SUSE) <pc@manguebit.com>
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      eb382196
    • Yonghong Song's avatar
      kallsyms: strip LTO-only suffixes from promoted global functions · 224ff8d6
      Yonghong Song authored
      [ Upstream commit 8cc32a9b ]
      
      Commit 6eb4bd92 ("kallsyms: strip LTO suffixes from static functions")
      stripped all function/variable suffixes started with '.' regardless
      of whether those suffixes are generated at LTO mode or not. In fact,
      as far as I know, in LTO mode, when a static function/variable is
      promoted to the global scope, '.llvm.<...>' suffix is added.
      
      The existing mechanism breaks live patch for a LTO kernel even if
      no <symbol>.llvm.<...> symbols are involved. For example, for the following
      kernel symbols:
        $ grep bpf_verifier_vlog /proc/kallsyms
        ffffffff81549f60 t bpf_verifier_vlog
        ffffffff8268b430 d bpf_verifier_vlog._entry
        ffffffff8282a958 d bpf_verifier_vlog._entry_ptr
        ffffffff82e12a1f d bpf_verifier_vlog.__already_done
      'bpf_verifier_vlog' is a static function. '_entry', '_entry_ptr' and
      '__already_done' are static variables used inside 'bpf_verifier_vlog',
      so llvm promotes them to file-level static with prefix 'bpf_verifier_vlog.'.
      Note that the func-level to file-level static function promotion also
      happens without LTO.
      
      Given a symbol name 'bpf_verifier_vlog', with LTO kernel, current mechanism will
      return 4 symbols to live patch subsystem which current live patching
      subsystem cannot handle it. With non-LTO kernel, only one symbol
      is returned.
      
      In [1], we have a lengthy discussion, the suggestion is to separate two
      cases:
        (1). new symbols with suffix which are generated regardless of whether
             LTO is enabled or not, and
        (2). new symbols with suffix generated only when LTO is enabled.
      
      The cleanup_symbol_name() should only remove suffixes for case (2).
      Case (1) should not be changed so it can work uniformly with or without LTO.
      
      This patch removed LTO-only suffix '.llvm.<...>' so live patching and
      tracing should work the same way for non-LTO kernel.
      The cleanup_symbol_name() in scripts/kallsyms.c is also changed to have the same
      filtering pattern so both kernel and kallsyms tool have the same
      expectation on the order of symbols.
      
       [1] https://lore.kernel.org/live-patching/20230615170048.2382735-1-song@kernel.org/T/#u
      
      Fixes: 6eb4bd92
      
       ("kallsyms: strip LTO suffixes from static functions")
      Reported-by: default avatarSong Liu <song@kernel.org>
      Signed-off-by: default avatarYonghong Song <yhs@fb.com>
      Reviewed-by: default avatarZhen Lei <thunder.leizhen@huawei.com>
      Reviewed-by: default avatarNick Desaulniers <ndesaulniers@google.com>
      Acked-by: default avatarSong Liu <song@kernel.org>
      Link: https://lore.kernel.org/r/20230628181926.4102448-1-yhs@fb.com
      Signed-off-by: default avatarKees Cook <keescook@chromium.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      224ff8d6
    • Jaewon Kim's avatar
      spi: s3c64xx: clear loopback bit after loopback test · 03e37c96
      Jaewon Kim authored
      [ Upstream commit 9ec3c551
      
       ]
      
      When SPI loopback transfer is performed, S3C64XX_SPI_MODE_SELF_LOOPBACK
      bit still remained. It works as loopback even if the next transfer is
      not spi loopback mode.
      If not SPI_LOOP, needs to clear S3C64XX_SPI_MODE_SELF_LOOPBACK bit.
      
      Signed-off-by: default avatarJaewon Kim <jaewon02.kim@samsung.com>
      Fixes: ffb7bcd3
      
       ("spi: s3c64xx: support loopback mode")
      Reviewed-by: default avatarChanho Park <chanho61.park@samsung.com>
      Link: https://lore.kernel.org/r/20230711082020.138165-1-jaewon02.kim@samsung.com
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      03e37c96
    • Christoph Hellwig's avatar
      btrfs: be a bit more careful when setting mirror_num_ret in btrfs_map_block · 0d7c5934
      Christoph Hellwig authored
      [ Upstream commit 4e7de35e ]
      
      The mirror_num_ret is allowed to be NULL, although it has to be set when
      smap is set.  Unfortunately that is not a well enough specifiable
      invariant for static type checkers, so add a NULL check to make sure they
      are fine.
      
      Fixes: 03793cbb
      
       ("btrfs: add fast path for single device io in __btrfs_map_block")
      Reported-by: default avatarDan Carpenter <dan.carpenter@linaro.org>
      Reviewed-by: default avatarQu Wenruo <wqu@suse.com>
      Reviewed-by: default avatarJohannes Thumshirn <johannes.thumshirn@wdc.com>
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      0d7c5934
    • James Clark's avatar
      perf build: Fix library not found error when using CSLIBS · 3b1297c4
      James Clark authored
      [ Upstream commit 1feece27 ]
      
      -L only specifies the search path for libraries directly provided in the
      link line with -l. Because -lopencsd isn't specified, it's only linked
      because it's a dependency of -lopencsd_c_api. Dependencies like this are
      resolved using the default system search paths or -rpath-link=... rather
      than -L. This means that compilation only works if OpenCSD is installed
      to the system rather than provided with the CSLIBS (-L) option.
      
      This could be fixed by adding -Wl,-rpath-link=$(CSLIBS) but that is less
      conventional than just adding -lopencsd to the link line so that it uses
      -L. -lopencsd seems to have been removed in commit ed17b191
      ("perf tools: Drop requirement for libstdc++.so for libopencsd check")
      because it was thought that there was a chance compilation would work
      even if it didn't exist, but I think that only applies to libstdc++ so
      there is no harm to add it back. libopencsd.so and libopencsd_c_api.so
      would always exist together.
      
      Testing
      =======
      
      The following scenarios now all work:
      
       * Cross build with OpenCSD installed
       * Cross build using CSLIBS=...
       * Native build with OpenCSD installed
       * Native build using CSLIBS=...
       * Static cross build with OpenCSD installed
       * Static cross build with CSLIBS=...
      
      Committer testing:
      
        ⬢[acme@toolbox perf-tools]$ alias m
        alias m='make -k BUILD_BPF_SKEL=1 CORESIGHT=1 O=/tmp/build/perf-tools -C tools/perf install-bin && git status && perf test python ;  perf record -o /dev/null sleep 0.01 ; perf stat --null sleep 0.01'
        ⬢[acme@toolbox perf-tools]$ ldd ~/bin/perf | grep csd
        	libopencsd_c_api.so.1 => /lib64/libopencsd_c_api.so.1 (0x00007fd49c44e000)
        	libopencsd.so.1 => /lib64/libopencsd.so.1 (0x00007fd49bd56000)
        ⬢[acme@toolbox perf-tools]$ cat /etc/redhat-release
        Fedora release 36 (Thirty Six)
        ⬢[acme@toolbox perf-tools]$
      
      Fixes: ed17b191
      
       ("perf tools: Drop requirement for libstdc++.so for libopencsd check")
      Reported-by: default avatarRadhey Shyam Pandey <radhey.shyam.pandey@amd.com>
      Signed-off-by: default avatarJames Clark <james.clark@arm.com>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Tested-by: default avatarRadhey Shyam Pandey <radhey.shyam.pandey@amd.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Uwe Kleine-König <uwe@kleine-koenig.org>
      Cc: coresight@lists.linaro.org
      Closes: https://lore.kernel.org/linux-arm-kernel/56905d7a-a91e-883a-b707-9d5f686ba5f1@arm.com/
      Link: https://lore.kernel.org/all/36cc4dc6-bf4b-1093-1c0a-876e368af183@kleine-koenig.org/
      Link: https://lore.kernel.org/r/20230707154546.456720-1-james.clark@arm.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      3b1297c4
    • Yangtao Li's avatar
      fbdev: imxfb: Removed unneeded release_mem_region · 38282a92
      Yangtao Li authored
      [ Upstream commit 45fcc058 ]
      
      Remove unnecessary release_mem_region from the error path to prevent
      mem region from being released twice, which could avoid resource leak
      or other unexpected issues.
      
      Fixes: b083c22d
      
       ("video: fbdev: imxfb: Convert request_mem_region + ioremap to devm_ioremap_resource")
      Signed-off-by: default avatarYangtao Li <frank.li@vivo.com>
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      38282a92
    • Martin Kaiser's avatar
      fbdev: imxfb: warn about invalid left/right margin · 1a7ea3b0
      Martin Kaiser authored
      [ Upstream commit 4e47382f ]
      
      Warn about invalid var->left_margin or var->right_margin. Their values
      are read from the device tree.
      
      We store var->left_margin-3 and var->right_margin-1 in register
      fields. These fields should be >= 0.
      
      Fixes: 7e8549bc
      
       ("imxfb: Fix margin settings")
      Signed-off-by: default avatarMartin Kaiser <martin@kaiser.cx>
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      1a7ea3b0
    • Jonas Gorski's avatar
      spi: bcm63xx: fix max prepend length · 46d461f2
      Jonas Gorski authored
      [ Upstream commit 5158814c ]
      
      The command word is defined as following:
      
          /* Command */
          #define SPI_CMD_COMMAND_SHIFT           0
          #define SPI_CMD_DEVICE_ID_SHIFT         4
          #define SPI_CMD_PREPEND_BYTE_CNT_SHIFT  8
          #define SPI_CMD_ONE_BYTE_SHIFT          11
          #define SPI_CMD_ONE_WIRE_SHIFT          12
      
      If the prepend byte count field starts at bit 8, and the next defined
      bit is SPI_CMD_ONE_BYTE at bit 11, it can be at most 3 bits wide, and
      thus the max value is 7, not 15.
      
      Fixes: b17de076
      
       ("spi/bcm63xx: work around inability to keep CS up")
      Signed-off-by: default avatarJonas Gorski <jonas.gorski@gmail.com>
      Link: https://lore.kernel.org/r/20230629071453.62024-1-jonas.gorski@gmail.com
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      46d461f2
    • Biju Das's avatar
      pinctrl: renesas: rzg2l: Handle non-unique subnode names · 6d65f4a7
      Biju Das authored
      [ Upstream commit bfc374a1 ]
      
      Currently, sd1 and sd0 have unique subnode names 'sd1_mux' and 'sd0_mux'.
      If we change these to non-unique subnode names such as 'mux' this can
      lead to the below conflict as the RZ/G2L pin control driver considers
      only the names of the subnodes.
      
         pinctrl-rzg2l 11030000.pinctrl: pin P47_0 already requested by 11c00000.mmc; cannot claim for 11c10000.mmc
         pinctrl-rzg2l 11030000.pinctrl: pin-376 (11c10000.mmc) status -22
         pinctrl-rzg2l 11030000.pinctrl: could not request pin 376 (P47_0) from group mux  on device pinctrl-rzg2l
         renesas_sdhi_internal_dmac 11c10000.mmc: Error applying setting, reverse things back
      
      Fix this by constructing unique names from the node names of both the
      pin control configuration node and its child node, where appropriate.
      
      Based on the work done by Geert for the RZ/V2M pinctrl driver.
      
      Fixes: c4c4637e
      
       ("pinctrl: renesas: Add RZ/G2L pin and gpio controller driver")
      Signed-off-by: default avatarBiju Das <biju.das.jz@bp.renesas.com>
      Reviewed-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
      Link: https://lore.kernel.org/r/20230704111858.215278-1-biju.das.jz@bp.renesas.com
      Signed-off-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      6d65f4a7
    • Geert Uytterhoeven's avatar
      pinctrl: renesas: rzv2m: Handle non-unique subnode names · 3775d589
      Geert Uytterhoeven authored
      [ Upstream commit f46a0b47 ]
      
      The eMMC and SDHI pin control configuration nodes in DT have subnodes
      with the same names ("data" and "ctrl").  As the RZ/V2M pin control
      driver considers only the names of the subnodes, this leads to
      conflicts:
      
          pinctrl-rzv2m b6250000.pinctrl: pin P8_2 already requested by 85000000.mmc; cannot claim for 85020000.mmc
          pinctrl-rzv2m b6250000.pinctrl: pin-130 (85020000.mmc) status -22
          renesas_sdhi_internal_dmac 85020000.mmc: Error applying setting, reverse things back
      
      Fix this by constructing unique names from the node names of both the
      pin control configuration node and its child node, where appropriate.
      
      Reported by: Fabrizio Castro <fabrizio.castro.jz@renesas.com>
      
      Fixes: 92a9b825
      
       ("pinctrl: renesas: Add RZ/V2M pin and gpio controller driver")
      Signed-off-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
      Tested-by: default avatarFabrizio Castro <fabrizio.castro.jz@renesas.com>
      Link: https://lore.kernel.org/r/607bd6ab4905b0b1b119a06ef953fa1184505777.1688396717.git.geert+renesas@glider.be
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      3775d589
    • Suren Baghdasaryan's avatar
      sched/psi: use kernfs polling functions for PSI trigger polling · d124ab17
      Suren Baghdasaryan authored
      [ Upstream commit aff03707 ]
      
      Destroying psi trigger in cgroup_file_release causes UAF issues when
      a cgroup is removed from under a polling process. This is happening
      because cgroup removal causes a call to cgroup_file_release while the
      actual file is still alive. Destroying the trigger at this point would
      also destroy its waitqueue head and if there is still a polling process
      on that file accessing the waitqueue, it will step on the freed pointer:
      
      do_select
        vfs_poll
                                 do_rmdir
                                   cgroup_rmdir
                                     kernfs_drain_open_files
                                       cgroup_file_release
                                         cgroup_pressure_release
                                           psi_trigger_destroy
                                             wake_up_pollfree(&t->event_wait)
      // vfs_poll is unblocked
                                             synchronize_rcu
                                             kfree(t)
        poll_freewait -> UAF access to the trigger's waitqueue head
      
      Patch [1] fixed this issue for epoll() case using wake_up_pollfree(),
      however the same issue exists for synchronous poll() case.
      The root cause of this issue is that the lifecycles of the psi trigger's
      waitqueue and of the file associated with the trigger are different. Fix
      this by using kernfs_generic_poll function when polling on cgroup-specific
      psi triggers. It internally uses kernfs_open_node->poll waitqueue head
      with its lifecycle tied to the file's lifecycle. This also renders the
      fix in [1] obsolete, so revert it.
      
      [1] commit c2dbe32d ("sched/psi: Fix use-after-free in ep_remove_wait_queue()")
      
      Fixes: 0e94682b
      
       ("psi: introduce psi monitor")
      Closes: https://lore.kernel.org/all/20230613062306.101831-1-lujialin4@huawei.com/
      Reported-by: default avatarLu Jialin <lujialin4@huawei.com>
      Signed-off-by: default avatarSuren Baghdasaryan <surenb@google.com>
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Link: https://lkml.kernel.org/r/20230630005612.1014540-1-surenb@google.com
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      d124ab17
    • Miaohe Lin's avatar
      sched/fair: Use recent_used_cpu to test p->cpus_ptr · cf954dd7
      Miaohe Lin authored
      [ Upstream commit ae2ad293 ]
      
      When checking whether a recently used CPU can be a potential idle
      candidate, recent_used_cpu should be used to test p->cpus_ptr as
      p->recent_used_cpu is not equal to recent_used_cpu and candidate
      decision is made based on recent_used_cpu here.
      
      Fixes: 89aafd67
      
       ("sched/fair: Use prev instead of new target as recent_used_cpu")
      Signed-off-by: default avatarMiaohe Lin <linmiaohe@huawei.com>
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Reviewed-by: default avatarPhil Auld <pauld@redhat.com>
      Acked-by: default avatarMel Gorman <mgorman@suse.de>
      Link: https://lore.kernel.org/r/20230620080747.359122-1-linmiaohe@huawei.com
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      cf954dd7
    • Peter Zijlstra's avatar
      iov_iter: Mark copy_iovec_from_user() noclone · 04db1d8a
      Peter Zijlstra authored
      [ Upstream commit 719a937b ]
      
      Extend commit 50f9a76e ("iov_iter: Mark
      copy_compat_iovec_from_user() noinline") to also cover
      copy_iovec_from_user(). Different compiler versions cause the same
      problem on different functions.
      
      lib/iov_iter.o: warning: objtool: .altinstr_replacement+0x1f: redundant UACCESS disable
      lib/iov_iter.o: warning: objtool: iovec_from_user+0x84: call to copy_iovec_from_user.part.0() with UACCESS enabled
      lib/iov_iter.o: warning: objtool: __import_iovec+0x143: call to copy_iovec_from_user.part.0() with UACCESS enabled
      
      Fixes: 50f9a76e
      
       ("iov_iter: Mark copy_compat_iovec_from_user() noinline")
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Tested-by: default avatarBorislav Petkov (AMD) <bp@alien8.de>
      Link: https://lkml.kernel.org/r/20230616124354.GD4253@hirez.programming.kicks-ass.net
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      04db1d8a
    • Srinivas Kandagatla's avatar
      ASoC: qcom: q6apm: do not close GPR port before closing graph · ea5f73dc
      Srinivas Kandagatla authored
      [ Upstream commit c1be6292 ]
      
      Closing GPR port before graph close can result in un handled notifications
      from DSP, this results in spam of errors from GPR driver as there is no
      one to handle these notification at that point in time.
      
      Fix this by closing GPR port after graph close is finished.
      
      Fixes: 5477518b
      
       ("ASoC: qdsp6: audioreach: add q6apm support")
      Signed-off-by: default avatarSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
      Link: https://lore.kernel.org/r/20230705131842.41584-1-srinivas.kandagatla@linaro.org
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      ea5f73dc
    • Srinivas Kandagatla's avatar
      ASoC: codecs: wcd938x: fix dB range for HPHL and HPHR · 35e3982b
      Srinivas Kandagatla authored
      [ Upstream commit c03226ba ]
      
      dB range for HPHL and HPHR gains are from +6dB to -30dB in steps of
      1.5dB with register values range from 0 to 24.
      
      Current code maps these dB ranges incorrectly, fix them to allow proper
      volume setting.
      
      Fixes: e8ba1e05
      
       ("ASoC: codecs: wcd938x: add basic controls")
      Signed-off-by: default avatarSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
      Link: https://lore.kernel.org/r/20230705125723.40464-1-srinivas.kandagatla@linaro.org
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      35e3982b
    • Johan Hovold's avatar
      ASoC: codecs: wcd938x: fix mbhc impedance loglevel · 3a5a0585
      Johan Hovold authored
      [ Upstream commit e5ce198b ]
      
      Demote the MBHC impedance measurement printk, which is not an error
      message, from error to debug level.
      
      While at it, fix the capitalisation of "ohm" and add the missing space
      before the opening parenthesis.
      
      Fixes: bcee7ed0
      
       ("ASoC: codecs: wcd938x: add Multi Button Headset Control support")
      Signed-off-by: default avatarJohan Hovold <johan+linaro@kernel.org>
      Reviewed-by: default avatarSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
      Link: https://lore.kernel.org/r/20230630142717.5314-2-johan+linaro@kernel.org
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      3a5a0585
    • Vijendar Mukunda's avatar
      ASoC: amd: acp: fix for invalid dai id handling in acp_get_byte_count() · 8e7b0064
      Vijendar Mukunda authored
      [ Upstream commit 85aeab36 ]
      
      For invalid dai id, instead of returning -EINVAL
      return bytes count as zero in acp_get_byte_count() function.
      
      Fixes: 623621a9
      
       ("ASoC: amd: Add common framework to support I2S on ACP SOC")
      
      Signed-off-by: default avatarVijendar Mukunda <Vijendar.Mukunda@amd.com>
      Link: https://lore.kernel.org/r/20230626105356.2580125-6-Vijendar.Mukunda@amd.com
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      8e7b0064
    • Hao Chen's avatar
      net: hns3: fix strncpy() not using dest-buf length as length issue · 14621889
      Hao Chen authored
      [ Upstream commit 1cf3d556
      
       ]
      
      Now, strncpy() in hns3_dbg_fill_content() use src-length as copy-length,
      it may result in dest-buf overflow.
      
      This patch is to fix intel compile warning for csky-linux-gcc (GCC) 12.1.0
      compiler.
      
      The warning reports as below:
      
      hclge_debugfs.c:92:25: warning: 'strncpy' specified bound depends on
      the length of the source argument [-Wstringop-truncation]
      
      strncpy(pos, items[i].name, strlen(items[i].name));
      
      hclge_debugfs.c:90:25: warning: 'strncpy' output truncated before
      terminating nul copying as many bytes from a string as its length
      [-Wstringop-truncation]
      
      strncpy(pos, result[i], strlen(result[i]));
      
      strncpy() use src-length as copy-length, it may result in
      dest-buf overflow.
      
      So,this patch add some values check to avoid this issue.
      
      Signed-off-by: default avatarHao Chen <chenhao418@huawei.com>
      Reported-by: default avatarkernel test robot <lkp@intel.com>
      Closes: https://lore.kernel.org/lkml/202207170606.7WtHs9yS-lkp@intel.com/T/
      Signed-off-by: default avatarHao Lan <lanhao@huawei.com>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      14621889
    • Ying Hsu's avatar
      igb: Fix igb_down hung on surprise removal · 41f63b72
      Ying Hsu authored
      [ Upstream commit 004d2506
      
       ]
      
      In a setup where a Thunderbolt hub connects to Ethernet and a display
      through USB Type-C, users may experience a hung task timeout when they
      remove the cable between the PC and the Thunderbolt hub.
      This is because the igb_down function is called multiple times when
      the Thunderbolt hub is unplugged. For example, the igb_io_error_detected
      triggers the first call, and the igb_remove triggers the second call.
      The second call to igb_down will block at napi_synchronize.
      Here's the call trace:
          __schedule+0x3b0/0xddb
          ? __mod_timer+0x164/0x5d3
          schedule+0x44/0xa8
          schedule_timeout+0xb2/0x2a4
          ? run_local_timers+0x4e/0x4e
          msleep+0x31/0x38
          igb_down+0x12c/0x22a [igb 6615058754948bfde0bf01429257eb59f13030d4]
          __igb_close+0x6f/0x9c [igb 6615058754948bfde0bf01429257eb59f13030d4]
          igb_close+0x23/0x2b [igb 6615058754948bfde0bf01429257eb59f13030d4]
          __dev_close_many+0x95/0xec
          dev_close_many+0x6e/0x103
          unregister_netdevice_many+0x105/0x5b1
          unregister_netdevice_queue+0xc2/0x10d
          unregister_netdev+0x1c/0x23
          igb_remove+0xa7/0x11c [igb 6615058754948bfde0bf01429257eb59f13030d4]
          pci_device_remove+0x3f/0x9c
          device_release_driver_internal+0xfe/0x1b4
          pci_stop_bus_device+0x5b/0x7f
          pci_stop_bus_device+0x30/0x7f
          pci_stop_bus_device+0x30/0x7f
          pci_stop_and_remove_bus_device+0x12/0x19
          pciehp_unconfigure_device+0x76/0xe9
          pciehp_disable_slot+0x6e/0x131
          pciehp_handle_presence_or_link_change+0x7a/0x3f7
          pciehp_ist+0xbe/0x194
          irq_thread_fn+0x22/0x4d
          ? irq_thread+0x1fd/0x1fd
          irq_thread+0x17b/0x1fd
          ? irq_forced_thread_fn+0x5f/0x5f
          kthread+0x142/0x153
          ? __irq_get_irqchip_state+0x46/0x46
          ? kthread_associate_blkcg+0x71/0x71
          ret_from_fork+0x1f/0x30
      
      In this case, igb_io_error_detected detaches the network interface
      and requests a PCIE slot reset, however, the PCIE reset callback is
      not being invoked and thus the Ethernet connection breaks down.
      As the PCIE error in this case is a non-fatal one, requesting a
      slot reset can be avoided.
      This patch fixes the task hung issue and preserves Ethernet
      connection by ignoring non-fatal PCIE errors.
      
      Signed-off-by: default avatarYing Hsu <yinghsu@chromium.org>
      Tested-by: Pucha Himasekhar Reddy <himasekharx.reddy.pucha@intel.com> (A Contingent worker at Intel)
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      Reviewed-by: default avatarSimon Horman <simon.horman@corigine.com>
      Link: https://lore.kernel.org/r/20230620174732.4145155-1-anthony.l.nguyen@intel.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      41f63b72
    • Yi Kuo's avatar
      wifi: iwlwifi: pcie: add device id 51F1 for killer 1675 · ed64a07d
      Yi Kuo authored
      [ Upstream commit f4daceae
      
       ]
      
      Intel Killer AX1675i/s with device id 51f1 would show
      "No config found for PCI dev 51f1/1672" in dmesg and refuse to work.
      Add the new device id 51F1 for 1675i/s to fix the issue.
      
      Signed-off-by: default avatarYi Kuo <yi@yikuo.dev>
      Signed-off-by: default avatarGregory Greenman <gregory.greenman@intel.com>
      Link: https://lore.kernel.org/r/20230621130444.ee224675380b.I921c905e21e8d041ad808def8f454f27b5ebcd8b@changeid
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      ed64a07d
    • Johannes Berg's avatar
      wifi: iwlwifi: mvm: avoid baid size integer overflow · 65b76a25
      Johannes Berg authored
      [ Upstream commit 1a528ab1
      
       ]
      
      Roee reported various hard-to-debug crashes with pings in
      EHT aggregation scenarios. Enabling KASAN showed that we
      access the BAID allocation out of bounds, and looking at
      the code a bit shows that since the reorder buffer entry
      (struct iwl_mvm_reorder_buf_entry) is 128 bytes if debug
      such as lockdep is enabled, then staring from an agg size
      512 we overflow the size calculation, and allocate a much
      smaller structure than we should, causing slab corruption
      once we initialize this.
      
      Fix this by simply using u32 instead of u16.
      
      Reported-by: default avatarRoee Goldfiner <roee.h.goldfiner@intel.com>
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: default avatarGregory Greenman <gregory.greenman@intel.com>
      Link: https://lore.kernel.org/r/20230620125813.f428c856030d.I2c2bb808e945adb71bc15f5b2bac2d8957ea90eb@changeid
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      65b76a25