Skip to content
  1. Apr 06, 2023
    • Ivan Orlov's avatar
      can: bcm: bcm_tx_setup(): fix KMSAN uninit-value in vfs_write · c11dbc77
      Ivan Orlov authored
      [ Upstream commit 2b4c99f7
      
       ]
      
      Syzkaller reported the following issue:
      
      =====================================================
      BUG: KMSAN: uninit-value in aio_rw_done fs/aio.c:1520 [inline]
      BUG: KMSAN: uninit-value in aio_write+0x899/0x950 fs/aio.c:1600
       aio_rw_done fs/aio.c:1520 [inline]
       aio_write+0x899/0x950 fs/aio.c:1600
       io_submit_one+0x1d1c/0x3bf0 fs/aio.c:2019
       __do_sys_io_submit fs/aio.c:2078 [inline]
       __se_sys_io_submit+0x293/0x770 fs/aio.c:2048
       __x64_sys_io_submit+0x92/0xd0 fs/aio.c:2048
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x63/0xcd
      
      Uninit was created at:
       slab_post_alloc_hook mm/slab.h:766 [inline]
       slab_alloc_node mm/slub.c:3452 [inline]
       __kmem_cache_alloc_node+0x71f/0xce0 mm/slub.c:3491
       __do_kmalloc_node mm/slab_common.c:967 [inline]
       __kmalloc+0x11d/0x3b0 mm/slab_common.c:981
       kmalloc_array include/linux/slab.h:636 [inline]
       bcm_tx_setup+0x80e/0x29d0 net/can/bcm.c:930
       bcm_sendmsg+0x3a2/0xce0 net/can/bcm.c:1351
       sock_sendmsg_nosec net/socket.c:714 [inline]
       sock_sendmsg net/socket.c:734 [inline]
       sock_write_iter+0x495/0x5e0 net/socket.c:1108
       call_write_iter include/linux/fs.h:2189 [inline]
       aio_write+0x63a/0x950 fs/aio.c:1600
       io_submit_one+0x1d1c/0x3bf0 fs/aio.c:2019
       __do_sys_io_submit fs/aio.c:2078 [inline]
       __se_sys_io_submit+0x293/0x770 fs/aio.c:2048
       __x64_sys_io_submit+0x92/0xd0 fs/aio.c:2048
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x63/0xcd
      
      CPU: 1 PID: 5034 Comm: syz-executor350 Not tainted 6.2.0-rc6-syzkaller-80422-geda666ff2276 #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/12/2023
      =====================================================
      
      We can follow the call chain and find that 'bcm_tx_setup' function
      calls 'memcpy_from_msg' to copy some content to the newly allocated
      frame of 'op->frames'. After that the 'len' field of copied structure
      being compared with some constant value (64 or 8). However, if
      'memcpy_from_msg' returns an error, we will compare some uninitialized
      memory. This triggers 'uninit-value' issue.
      
      This patch will add 'memcpy_from_msg' possible errors processing to
      avoid uninit-value issue.
      
      Tested via syzkaller
      
      Reported-by: default avatar <syzbot+c9bfd85eca611ebf5db1@syzkaller.appspotmail.com>
      Link: https://syzkaller.appspot.com/bug?id=47f897f8ad958bbde5790ebf389b5e7e0a345089
      Signed-off-by: default avatarIvan Orlov <ivan.orlov0322@gmail.com>
      Fixes: 6f3b911d
      
       ("can: bcm: add support for CAN FD frames")
      Acked-by: default avatarOliver Hartkopp <socketcan@hartkopp.net>
      Link: https://lore.kernel.org/all/20230314120445.12407-1-ivan.orlov0322@gmail.com
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      c11dbc77
    • Rajvi Jingar's avatar
      platform/x86/intel/pmc: Alder Lake PCH slp_s0_residency fix · 7ffdf7e6
      Rajvi Jingar authored
      [ Upstream commit fb575510 ]
      
      For platforms with Alder Lake PCH (Alder Lake S and Raptor Lake S) the
      slp_s0_residency attribute has been reporting the wrong value. Unlike other
      platforms, ADL PCH does not have a counter for the time that the SLP_S0
      signal was asserted. Instead, firmware uses the aggregate of the Low Power
      Mode (LPM) substate counters as the S0ix value.  Since the LPM counters run
      at a different frequency, this lead to misreporting of the S0ix time.
      
      Add a check for Alder Lake PCH and adjust the frequency accordingly when
      display slp_s0_residency.
      
      Fixes: bbab3110
      
       ("platform/x86/intel: pmc/core: Add Alderlake support to pmc core driver")
      Signed-off-by: default avatarRajvi Jingar <rajvi.jingar@linux.intel.com>
      Signed-off-by: default avatarDavid E. Box <david.e.box@linux.intel.com>
      Reviewed-by: default avatarRajneesh Bhardwaj <irenic.rajneesh@gmail.com>
      Reviewed-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
      Link: https://lore.kernel.org/r/20230320212029.3154407-1-david.e.box@linux.intel.com
      Reviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      7ffdf7e6
    • Imre Deak's avatar
      drm/i915/tc: Fix the ICL PHY ownership check in TC-cold state · 75084659
      Imre Deak authored
      [ Upstream commit 38c58301 ]
      
      The commit renaming icl_tc_phy_is_in_safe_mode() to
      icl_tc_phy_take_ownership() didn't flip the function's return value
      accordingly, fix this up.
      
      This didn't cause an actual problem besides state check errors, since
      the function is only used during HW readout.
      
      Cc: José Roberto de Souza <jose.souza@intel.com>
      Fixes: f53979d6
      
       ("drm/i915/display/tc: Rename safe_mode functions ownership")
      Reviewed-by: default avatarJosé Roberto de Souza <jose.souza@intel.com>
      Reviewed-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      Signed-off-by: default avatarImre Deak <imre.deak@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20230316131724.359612-4-imre.deak@intel.com
      (cherry picked from commit f2c7959d
      
      )
      Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      75084659
    • Vladimir Oltean's avatar
      net: stmmac: don't reject VLANs when IFF_PROMISC is set · ce1b88dd
      Vladimir Oltean authored
      [ Upstream commit a7602e73 ]
      
      The blamed commit has introduced the following tests to
      dwmac4_add_hw_vlan_rx_fltr(), called from stmmac_vlan_rx_add_vid():
      
      	if (hw->promisc) {
      		netdev_err(dev,
      			   "Adding VLAN in promisc mode not supported\n");
      		return -EPERM;
      	}
      
      "VLAN promiscuous" mode is keyed in this driver to IFF_PROMISC, and so,
      vlan_vid_add() and vlan_vid_del() calls cannot take place in IFF_PROMISC
      mode. I have the following 2 arguments that this restriction is.... hm,
      how shall I put it nicely... unproductive :)
      
      First, take the case of a Linux bridge. If the kernel is compiled with
      CONFIG_BRIDGE_VLAN_FILTERING=y, then this bridge shall have a VLAN
      database. The bridge shall try to call vlan_add_vid() on its bridge
      ports for each VLAN in the VLAN table. It will do this irrespectively of
      whether that port is *currently* VLAN-aware or not. So it will do this
      even when the bridge was created with vlan_filtering 0.
      But the Linux bridge, in VLAN-unaware mode, configures its ports in
      promiscuous (IFF_PROMISC) mode, so that they accept packets with any
      MAC DA (a switch must do this in order to forward those packets which
      are not directly targeted to its MAC address).
      
      As a result, the stmmac driver does not work as a bridge port, when the
      kernel is compiled with CONFIG_BRIDGE_VLAN_FILTERING=y.
      
      $ ip link add br0 type bridge && ip link set br0 up
      $ ip link set eth0 master br0 && ip link set eth0 up
      [ 2333.943296] br0: port 1(eth0) entered blocking state
      [ 2333.943381] br0: port 1(eth0) entered disabled state
      [ 2333.943782] device eth0 entered promiscuous mode
      [ 2333.944080] 4033c000.ethernet eth0: Adding VLAN in promisc mode not supported
      [ 2333.976509] 4033c000.ethernet eth0: failed to initialize vlan filtering on this port
      RTNETLINK answers: Operation not permitted
      
      Secondly, take the case of stmmac as DSA master. Some switch tagging
      protocols are based on 802.1Q VLANs (tag_sja1105.c), and as such,
      tag_8021q.c uses vlan_vid_add() to work with VLAN-filtering DSA masters.
      But also, when a DSA port becomes promiscuous (for example when it joins
      a bridge), the DSA framework also makes the DSA master promiscuous.
      
      Moreover, for every VLAN that a DSA switch sends to the CPU, DSA also
      programs a VLAN filter on the DSA master, because if the the DSA switch
      uses a tail tag, then the hardware frame parser of the DSA master will
      see VLAN as VLAN, and might filter them out, for being unknown.
      
      Due to the above 2 reasons, my belief is that the stmmac driver does not
      get to choose to not accept vlan_vid_add() calls while IFF_PROMISC is
      enabled, because the 2 are completely independent and there are code
      paths in the network stack which directly lead to this situation
      occurring, without the user's direct input.
      
      In fact, my belief is that "VLAN promiscuous" mode should have never
      been keyed on IFF_PROMISC in the first place, but rather, on the
      NETIF_F_HW_VLAN_CTAG_FILTER feature flag which can be toggled by the
      user through ethtool -k, when present in netdev->hw_features.
      
      In the stmmac driver, NETIF_F_HW_VLAN_CTAG_FILTER is only present in
      "features", making this feature "on [fixed]".
      
      I have this belief because I am unaware of any definition of promiscuity
      which implies having an effect on anything other than MAC DA (therefore
      not VLAN). However, I seem to be rather alone in having this opinion,
      looking back at the disagreements from this discussion:
      https://lore.kernel.org/netdev/20201110153958.ci5ekor3o2ekg3ky@ipetronik.com/
      
      In any case, to remove the vlan_vid_add() dependency on !IFF_PROMISC,
      one would need to remove the check and see what fails. I guess the test
      was there because of the way in which dwmac4_vlan_promisc_enable() is
      implemented.
      
      For context, the dwmac4 supports Perfect Filtering for a limited number
      of VLANs - dwmac4_get_num_vlan(), priv->hw->num_vlan, with a fallback on
      Hash Filtering - priv->dma_cap.vlhash - see stmmac_vlan_update(), also
      visible in cat /sys/kernel/debug/stmmaceth/eth0/dma_cap | grep 'VLAN
      Hash Filtering'.
      
      The perfect filtering is based on MAC_VLAN_Tag_Filter/MAC_VLAN_Tag_Data
      registers, accessed in the driver through dwmac4_write_vlan_filter().
      
      The hash filtering is based on the MAC_VLAN_Hash_Table register, named
      GMAC_VLAN_HASH_TABLE in the driver and accessed by dwmac4_update_vlan_hash().
      The control bit for enabling hash filtering is GMAC_VLAN_VTHM
      (MAC_VLAN_Tag_Ctrl bit VTHM: VLAN Tag Hash Table Match Enable).
      
      Now, the description of dwmac4_vlan_promisc_enable() is that it iterates
      through the driver's cache of perfect filter entries (hw->vlan_filter[i],
      added by dwmac4_add_hw_vlan_rx_fltr()), and evicts them from hardware by
      unsetting their GMAC_VLAN_TAG_DATA_VEN (MAC_VLAN_Tag_Data bit VEN - VLAN
      Tag Enable) bit. Then it unsets the GMAC_VLAN_VTHM bit, which disables
      hash matching.
      
      This leaves the MAC, according to table "VLAN Match Status" from the
      documentation, to always enter these data paths:
      
      VID    |VLAN Perfect Filter |VTHM Bit |VLAN Hash Filter |Final VLAN Match
             |Match Result        |         |Match Result     |Status
      -------|--------------------|---------|-----------------|----------------
      VID!=0 |Fail                |0        |don't care       |Pass
      
      So, dwmac4_vlan_promisc_enable() does its job, but by unsetting
      GMAC_VLAN_VTHM, it conflicts with the other code path which controls
      this bit: dwmac4_update_vlan_hash(), called through stmmac_update_vlan_hash()
      from stmmac_vlan_rx_add_vid() and from stmmac_vlan_rx_kill_vid().
      This is, I guess, why dwmac4_add_hw_vlan_rx_fltr() is not allowed to run
      after dwmac4_vlan_promisc_enable() has unset GMAC_VLAN_VTHM: because if
      it did, then dwmac4_update_vlan_hash() would set GMAC_VLAN_VTHM again,
      breaking the "VLAN promiscuity".
      
      It turns out that dwmac4_vlan_promisc_enable() is way too complicated
      for what needs to be done. The MAC_Packet_Filter register also has the
      VTFE bit (VLAN Tag Filter Enable), which simply controls whether VLAN
      tagged packets which don't match the filtering tables (either perfect or
      hash) are dropped or not. At the moment, this driver unconditionally
      sets GMAC_PACKET_FILTER_VTFE if NETIF_F_HW_VLAN_CTAG_FILTER was detected
      through the priv->dma_cap.vlhash capability bits of the device, in
      stmmac_dvr_probe().
      
      I would suggest deleting the unnecessarily complex logic from
      dwmac4_vlan_promisc_enable(), and simply unsetting GMAC_PACKET_FILTER_VTFE
      when becoming IFF_PROMISC, which has the same effect of allowing packets
      with any VLAN tags, but has the additional benefit of being able to run
      concurrently with stmmac_vlan_rx_add_vid() and stmmac_vlan_rx_kill_vid().
      
      As much as I believe that the VTFE bit should have been exclusively
      controlled by NETIF_F_HW_VLAN_CTAG_FILTER through ethtool, and not by
      IFF_PROMISC, changing that is not a punctual fix to the problem, and it
      would probably break the VFFQ feature added by the later commit
      e0f9956a ("net: stmmac: Add option for VLAN filter fail queue
      enable"). From the commit description, VFFQ needs IFF_PROMISC=on and
      VTFE=off in order to work (and this change respects that). But if VTFE
      was changed to be controlled through ethtool -k, then a user-visible
      change would have been introduced in Intel's scripts (a need to run
      "ethtool -k eth0 rx-vlan-filter off" which did not exist before).
      
      The patch was tested with this set of commands:
      
        ip link set eth0 up
        ip link add link eth0 name eth0.100 type vlan id 100
        ip addr add 192.168.100.2/24 dev eth0.100 && ip link set eth0.100 up
        ip link set eth0 promisc on
        ip link add link eth0 name eth0.101 type vlan id 101
        ip addr add 192.168.101.2/24 dev eth0.101 && ip link set eth0.101 up
        ip link set eth0 promisc off
        ping -c 5 192.168.100.1
        ping -c 5 192.168.101.1
        ip link set eth0 promisc on
        ping -c 5 192.168.100.1
        ping -c 5 192.168.101.1
        ip link del eth0.100
        ip link del eth0.101
        # Wait for VLAN-tagged pings from the other end...
        # Check with "tcpdump -i eth0 -e -n -p" and we should see them
        ip link set eth0 promisc off
        # Wait for VLAN-tagged pings from the other end...
        # Check with "tcpdump -i eth0 -e -n -p" and we shouldn't see them
        # anymore, but remove the "-p" argument from tcpdump and they're there.
      
      Fixes: c89f44ff
      
       ("net: stmmac: Add support for VLAN promiscuous mode")
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      ce1b88dd
    • Faicker Mo's avatar
      net/net_failover: fix txq exceeding warning · c942f5cd
      Faicker Mo authored
      [ Upstream commit e3cbdcb0 ]
      
      The failover txq is inited as 16 queues.
      when a packet is transmitted from the failover device firstly,
      the failover device will select the queue which is returned from
      the primary device if the primary device is UP and running.
      If the primary device txq is bigger than the default 16,
      it can lead to the following warning:
      eth0 selects TX queue 18, but real number of TX queues is 16
      
      The warning backtrace is:
      [   32.146376] CPU: 18 PID: 9134 Comm: chronyd Tainted: G            E      6.2.8-1.el7.centos.x86_64 #1
      [   32.147175] Hardware name: Red Hat KVM, BIOS 1.10.2-3.el7_4.1 04/01/2014
      [   32.147730] Call Trace:
      [   32.147971]  <TASK>
      [   32.148183]  dump_stack_lvl+0x48/0x70
      [   32.148514]  dump_stack+0x10/0x20
      [   32.148820]  netdev_core_pick_tx+0xb1/0xe0
      [   32.149180]  __dev_queue_xmit+0x529/0xcf0
      [   32.149533]  ? __check_object_size.part.0+0x21c/0x2c0
      [   32.149967]  ip_finish_output2+0x278/0x560
      [   32.150327]  __ip_finish_output+0x1fe/0x2f0
      [   32.150690]  ip_finish_output+0x2a/0xd0
      [   32.151032]  ip_output+0x7a/0x110
      [   32.151337]  ? __pfx_ip_finish_output+0x10/0x10
      [   32.151733]  ip_local_out+0x5e/0x70
      [   32.152054]  ip_send_skb+0x19/0x50
      [   32.152366]  udp_send_skb.isra.0+0x163/0x3a0
      [   32.152736]  udp_sendmsg+0xba8/0xec0
      [   32.153060]  ? __folio_memcg_unlock+0x25/0x60
      [   32.153445]  ? __pfx_ip_generic_getfrag+0x10/0x10
      [   32.153854]  ? sock_has_perm+0x85/0xa0
      [   32.154190]  inet_sendmsg+0x6d/0x80
      [   32.154508]  ? inet_sendmsg+0x6d/0x80
      [   32.154838]  sock_sendmsg+0x62/0x70
      [   32.155152]  ____sys_sendmsg+0x134/0x290
      [   32.155499]  ___sys_sendmsg+0x81/0xc0
      [   32.155828]  ? _get_random_bytes.part.0+0x79/0x1a0
      [   32.156240]  ? ip4_datagram_release_cb+0x5f/0x1e0
      [   32.156649]  ? get_random_u16+0x69/0xf0
      [   32.156989]  ? __fget_light+0xcf/0x110
      [   32.157326]  __sys_sendmmsg+0xc4/0x210
      [   32.157657]  ? __sys_connect+0xb7/0xe0
      [   32.157995]  ? __audit_syscall_entry+0xce/0x140
      [   32.158388]  ? syscall_trace_enter.isra.0+0x12c/0x1a0
      [   32.158820]  __x64_sys_sendmmsg+0x24/0x30
      [   32.159171]  do_syscall_64+0x38/0x90
      [   32.159493]  entry_SYSCALL_64_after_hwframe+0x72/0xdc
      
      Fix that by reducing txq number as the non-existent primary-dev does.
      
      Fixes: cfc80d9a
      
       ("net: Introduce net_failover driver")
      Signed-off-by: default avatarFaicker Mo <faicker.mo@ucloud.cn>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      c942f5cd
    • Christophe JAILLET's avatar
      regulator: Handle deferred clk · f70328a0
      Christophe JAILLET authored
      [ Upstream commit 02bcba0b ]
      
      devm_clk_get() can return -EPROBE_DEFER. So it is better to return the
      error code from devm_clk_get(), instead of a hard coded -ENOENT.
      
      This gives more opportunities to successfully probe the driver.
      
      Fixes: 8959e532
      
       ("regulator: fixed: add possibility to enable by clock")
      Signed-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
      Link: https://lore.kernel.org/r/18459fae3d017a66313699c7c8456b28158b2dd0.1679819354.git.christophe.jaillet@wanadoo.fr
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      f70328a0
    • ChunHao Lin's avatar
      r8169: fix RTL8168H and RTL8107E rx crc error · 1b808f5d
      ChunHao Lin authored
      [ Upstream commit 33189f0a ]
      
      When link speed is 10 Mbps and temperature is under -20°C, RTL8168H and
      RTL8107E may have rx crc error. Disable phy 10 Mbps pll off to fix this
      issue.
      
      Fixes: 6e1d0b89
      
       ("r8169:add support for RTL8168H and RTL8107E")
      Signed-off-by: default avatarChunHao Lin <hau@realtek.com>
      Reviewed-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>
      1b808f5d
    • Oleksij Rempel's avatar
      net: dsa: microchip: ksz8: fix MDB configuration with non-zero VID · 4ffa3fec
      Oleksij Rempel authored
      [ Upstream commit 9aa5757e ]
      
      FID is directly mapped to VID. However, configuring a MAC address with a
      VID != 0 resulted in incorrect configuration due to an incorrect bit
      mask. This kernel commit fixed the issue by correcting the bit mask and
      ensuring proper configuration of MAC addresses with non-zero VID.
      
      Fixes: 4b20a07e
      
       ("net: dsa: microchip: ksz8795: add support for ksz88xx chips")
      Signed-off-by: default avatarOleksij Rempel <o.rempel@pengutronix.de>
      Acked-by: default avatarArun Ramadoss <arun.ramadoss@microchip.com>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      4ffa3fec
    • Oleksij Rempel's avatar
      net: dsa: microchip: ksz8863_smi: fix bulk access · adfe5566
      Oleksij Rempel authored
      [ Upstream commit 392ff7a8 ]
      
      Current regmap bulk access is broken, resulting to wrong reads/writes
      if ksz_read64/ksz_write64 functions are used.
      Mostly this issue was visible by using ksz8_fdb_dump(), which returned
      corrupt MAC address.
      
      The reason is that regmap was configured to have max_raw_read/write,
      even if ksz8863_mdio_read/write functions are able to handle unlimited
      read/write accesses. On ksz_read64 function we are using multiple 32bit
      accesses by incrementing each access by 1 instead of 4. Resulting buffer
      had 01234567.12345678 instead of 01234567.89abcdef.
      
      We have multiple ways to fix it:
      - enable 4 byte alignment for 32bit accesses. Since the HW do not have
        this requirement. It will break driver.
      - disable max_raw_* limit.
      
      This patch is removing max_raw_* limit for regmap accesses in ksz8863_smi.
      
      Fixes: 60a36476
      
       ("net: dsa: microchip: Add Microchip KSZ8863 SMI based driver support")
      Signed-off-by: default avatarOleksij Rempel <o.rempel@pengutronix.de>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      adfe5566
    • Oleksij Rempel's avatar
      net: dsa: microchip: ksz8: ksz8_fdb_dump: avoid extracting ghost entry from... · 8d86ea65
      Oleksij Rempel authored
      net: dsa: microchip: ksz8: ksz8_fdb_dump: avoid extracting ghost entry from empty dynamic MAC table.
      
      [ Upstream commit 492606cd ]
      
      If the dynamic MAC table is empty, we will still extract one outdated
      entry. Fix it by using correct bit offset.
      
      Fixes: 4b20a07e
      
       ("net: dsa: microchip: ksz8795: add support for ksz88xx chips")
      Signed-off-by: default avatarOleksij Rempel <o.rempel@pengutronix.de>
      Acked-by: default avatarArun Ramadoss <arun.ramadoss@microchip.com>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      8d86ea65
    • Oleksij Rempel's avatar
      net: dsa: microchip: ksz8: fix offset for the timestamp filed · 628f76b8
      Oleksij Rempel authored
      [ Upstream commit b3177aab ]
      
      We are using wrong offset, so we will get not a timestamp.
      
      Fixes: 4b20a07e
      
       ("net: dsa: microchip: ksz8795: add support for ksz88xx chips")
      Signed-off-by: default avatarOleksij Rempel <o.rempel@pengutronix.de>
      Acked-by: default avatarArun Ramadoss <arun.ramadoss@microchip.com>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      628f76b8
    • Oleksij Rempel's avatar
      net: dsa: microchip: ksz8: fix ksz8_fdb_dump() to extract all 1024 entries · 91840597
      Oleksij Rempel authored
      [ Upstream commit 5d90492d ]
      
      Current ksz8_fdb_dump() is able to extract only max 249 entries on
      the ksz8863/ksz8873 series of switches. This happened due to wrong
      bit mask and offset calculation.
      
      This commit corrects the issue and allows for the complete extraction of
      all 1024 entries.
      
      Fixes: 4b20a07e
      
       ("net: dsa: microchip: ksz8795: add support for ksz88xx chips")
      Signed-off-by: default avatarOleksij Rempel <o.rempel@pengutronix.de>
      Acked-by: default avatarArun Ramadoss <arun.ramadoss@microchip.com>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      91840597
    • Oleksij Rempel's avatar
      net: dsa: microchip: ksz8: fix ksz8_fdb_dump() · 9524c2ea
      Oleksij Rempel authored
      [ Upstream commit 88e943e8 ]
      
      Before this patch, the ksz8_fdb_dump() function had several issues, such
      as uninitialized variables and incorrect usage of source port as a bit
      mask. These problems caused inaccurate reporting of vid information and
      port assignment in the bridge fdb.
      
      Fixes: e587be75
      
       ("net: dsa: microchip: update fdb add/del/dump in ksz_common")
      Signed-off-by: default avatarOleksij Rempel <o.rempel@pengutronix.de>
      Acked-by: default avatarArun Ramadoss <arun.ramadoss@microchip.com>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      9524c2ea
    • SongJingyi's avatar
      ptp_qoriq: fix memory leak in probe() · 43b4331c
      SongJingyi authored
      [ Upstream commit f3364222 ]
      
      Smatch complains that:
      drivers/ptp/ptp_qoriq.c ptp_qoriq_probe()
      warn: 'base' from ioremap() not released.
      
      Fix this by revising the parameter from 'ptp_qoriq->base' to 'base'.
      This is only a bug if ptp_qoriq_init() returns on the
      first -ENODEV error path.
      For other error paths ptp_qoriq->base and base are the same.
      And this change makes the code more readable.
      
      Fixes: 7f4399ba
      
       ("ptp_qoriq: fix NULL access if ptp dt node missing")
      Signed-off-by: default avatarSongJingyi <u201912584@hust.edu.cn>
      Reviewed-by: default avatarDan Carpenter <error27@gmail.com>
      Reviewed-by: default avatarDongliang Mu <dzm91@hust.edu.cn>
      Link: https://lore.kernel.org/r/20230324031406.1895159-1-u201912584@hust.edu.cn
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      43b4331c
    • Ahmad Fatoum's avatar
      net: dsa: realtek: fix out-of-bounds access · cc0f9bb9
      Ahmad Fatoum authored
      [ Upstream commit b93eb564 ]
      
      The probe function sets priv->chip_data to (void *)priv + sizeof(*priv)
      with the expectation that priv has enough trailing space.
      
      However, only realtek-smi actually allocated this chip_data space.
      Do likewise in realtek-mdio to fix out-of-bounds accesses.
      
      These accesses likely went unnoticed so far, because of an (unused)
      buf[4096] member in struct realtek_priv, which caused kmalloc to
      round up the allocated buffer to a big enough size, so nothing of
      value was overwritten. With a different allocator (like in the barebox
      bootloader port of the driver) or with KASAN, the memory corruption
      becomes quickly apparent.
      
      Fixes: aac94001
      
       ("net: dsa: realtek: add new mdio interface for drivers")
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Reviewed-by: default avatarLuiz Angelo Daros de Luca <luizluca@gmail.com>
      Reviewed-by: default avatarAlvin Šipraga <alsi@bang-olufsen.dk>
      Reviewed-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: default avatarAhmad Fatoum <a.fatoum@pengutronix.de>
      Link: https://lore.kernel.org/r/20230323103735.2331786-1-a.fatoum@pengutronix.de
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      cc0f9bb9
    • Jerry Snitselaar's avatar
      scsi: mpt3sas: Don't print sense pool info twice · 089e6318
      Jerry Snitselaar authored
      [ Upstream commit d684a7a2 ]
      
      _base_allocate_sense_dma_pool() already prints out the sense pool
      information, so don't print it a second time after calling it in
      _base_allocate_memory_pools(). In addition the version in
      _base_allocate_memory_pools() was using the wrong size value, sz, which was
      last assigned when doing some nvme calculations instead of sense_sz to
      determine the pool size in kilobytes.
      
      Cc: Sathya Prakash <sathya.prakash@broadcom.com>
      Cc: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
      Cc: Suganath Prabu Subramani <suganath-prabu.subramani@broadcom.com>
      Cc: MPT-FusionLinux.pdl@broadcom.com
      Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
      Cc: "James E.J. Bottomley" <jejb@linux.ibm.com>
      Fixes: 970ac2bb
      
       ("scsi: mpt3sas: Force sense buffer allocations to be within same 4 GB region")
      Signed-off-by: default avatarJerry Snitselaar <jsnitsel@redhat.com>
      Link: https://lore.kernel.org/r/20230324193204.567932-1-jsnitsel@redhat.com
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      089e6318
    • Tomas Henzl's avatar
      scsi: megaraid_sas: Fix crash after a double completion · 9526222c
      Tomas Henzl authored
      [ Upstream commit 2309df27 ]
      
      When a physical disk is attached directly "without JBOD MAP support" (see
      megasas_get_tm_devhandle()) then there is no real error handling in the
      driver.  Return FAILED instead of SUCCESS.
      
      Fixes: 18365b13
      
       ("megaraid_sas: Task management support")
      Signed-off-by: default avatarTomas Henzl <thenzl@redhat.com>
      Link: https://lore.kernel.org/r/20230324150134.14696-1-thenzl@redhat.com
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      9526222c
    • Íñigo Huguet's avatar
      sfc: ef10: don't overwrite offload features at NIC reset · 1da26860
      Íñigo Huguet authored
      [ Upstream commit ca4a80e4 ]
      
      At NIC reset, some offload features related to encapsulated traffic
      might have changed (this mainly happens if the firmware-variant is
      changed with the sfboot userspace tool). Because of this, features are
      checked and set again at reset time.
      
      However, this was not done right, and some features were improperly
      overwritten at NIC reset:
      - Tunneled IPv6 segmentation was always disabled
      - Features disabled with ethtool were reenabled
      - Features that becomes unsupported after the reset were not disabled
      
      Also, checking if the device supports IPV6_CSUM to enable TSO6 is no
      longer necessary because all currently supported devices support it.
      Additionally, move the assignment of some other features to the
      EF10_OFFLOAD_FEATURES macro, like it is done in ef100, leaving the
      selection of features in efx_pci_probe_post_io a bit cleaner.
      
      Fixes: ffffd245 ("sfc: correctly advertise tunneled IPv6 segmentation")
      Fixes: 24b2c375
      
       ("sfc: advertise encapsulated offloads on EF10")
      Reported-by: default avatarTianhao Zhao <tizhao@redhat.com>
      Suggested-by: default avatarJonathan Cooper <jonathan.s.cooper@amd.com>
      Tested-by: default avatarJonathan Cooper <jonathan.s.cooper@amd.com>
      Signed-off-by: default avatarÍñigo Huguet <ihuguet@redhat.com>
      Acked-by: default avatarEdward Cree <ecree.xilinx@gmail.com>
      Link: https://lore.kernel.org/r/20230323083417.7345-1-ihuguet@redhat.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      1da26860
    • Siddharth Kawar's avatar
      SUNRPC: fix shutdown of NFS TCP client socket · c5a159d5
      Siddharth Kawar authored
      [ Upstream commit 943d045a ]
      
      NFS server Duplicate Request Cache (DRC) algorithms rely on NFS clients
      reconnecting using the same local TCP port. Unique NFS operations are
      identified by the per-TCP connection set of XIDs. This prevents file
      corruption when non-idempotent NFS operations are retried.
      
      Currently, NFS client TCP connections are using different local TCP ports
      when reconnecting to NFS servers.
      
      After an NFS server initiates shutdown of the TCP connection, the NFS
      client's TCP socket is set to NULL after the socket state has reached
      TCP_LAST_ACK(9). When reconnecting, the new socket attempts to reuse
      the same local port but fails with EADDRNOTAVAIL (99). This forces the
      socket to use a different local TCP port to reconnect to the remote NFS
      server.
      
      State Transition and Events:
      TCP_CLOSE_WAIT(8)
      TCP_LAST_ACK(9)
      connect(fail EADDRNOTAVAIL(99))
      TCP_CLOSE(7)
      bind on new port
      connect success
      
      dmesg excerpts showing reconnect switching from TCP local port of 926 to
      763 after commit 7c81e6a9:
      [13354.947854] NFS call  mkdir testW
      ...
      [13405.654781] RPC:       xs_tcp_state_change client 00000000037d0f03...
      [13405.654813] RPC:       state 8 conn 1 dead 0 zapped 1 sk_shutdown 1
      [13405.654826] RPC:       xs_data_ready...
      [13405.654892] RPC:       xs_tcp_state_change client 00000000037d0f03...
      [13405.654895] RPC:       state 9 conn 0 dead 0 zapped 1 sk_shutdown 3
      [13405.654899] RPC:       xs_tcp_state_change client 00000000037d0f03...
      [13405.654900] RPC:       state 9 conn 0 dead 0 zapped 1 sk_shutdown 3
      [13405.654950] RPC:       xs_connect scheduled xprt 00000000037d0f03
      [13405.654975] RPC:       xs_bind 0.0.0.0:926: ok (0)
      [13405.654980] RPC:       worker connecting xprt 00000000037d0f03 via tcp
      			  to 10.101.6.228 (port 2049)
      [13405.654991] RPC:       00000000037d0f03 connect status 99 connected 0
      			  sock state 7
      [13405.655001] RPC:       xs_tcp_state_change client 00000000037d0f03...
      [13405.655002] RPC:       state 7 conn 0 dead 0 zapped 1 sk_shutdown 3
      [13405.655024] RPC:       xs_connect scheduled xprt 00000000037d0f03
      [13405.655038] RPC:       xs_bind 0.0.0.0:763: ok (0)
      [13405.655041] RPC:       worker connecting xprt 00000000037d0f03 via tcp
      			  to 10.101.6.228 (port 2049)
      [13405.655065] RPC:       00000000037d0f03 connect status 115 connected 0
      			  sock state 2
      
      State Transition and Events with patch applied:
      TCP_CLOSE_WAIT(8)
      TCP_LAST_ACK(9)
      TCP_CLOSE(7)
      connect(reuse of port succeeds)
      
      dmesg excerpts showing reconnect on same TCP local port of 936 with patch
      applied:
      [  257.139935] NFS: mkdir(0:59/560857152), testQ
      [  257.139937] NFS call  mkdir testQ
      ...
      [  307.822702] RPC:       state 8 conn 1 dead 0 zapped 1 sk_shutdown 1
      [  307.822714] RPC:       xs_data_ready...
      [  307.822817] RPC:       xs_tcp_state_change client 00000000ce702f14...
      [  307.822821] RPC:       state 9 conn 0 dead 0 zapped 1 sk_shutdown 3
      [  307.822825] RPC:       xs_tcp_state_change client 00000000ce702f14...
      [  307.822826] RPC:       state 9 conn 0 dead 0 zapped 1 sk_shutdown 3
      [  307.823606] RPC:       xs_tcp_state_change client 00000000ce702f14...
      [  307.823609] RPC:       state 7 conn 0 dead 0 zapped 1 sk_shutdown 3
      [  307.823629] RPC:       xs_tcp_state_change client 00000000ce702f14...
      [  307.823632] RPC:       state 7 conn 0 dead 0 zapped 1 sk_shutdown 3
      [  307.823676] RPC:       xs_connect scheduled xprt 00000000ce702f14
      [  307.823704] RPC:       xs_bind 0.0.0.0:936: ok (0)
      [  307.823709] RPC:       worker connecting xprt 00000000ce702f14 via tcp
      			  to 10.101.1.30 (port 2049)
      [  307.823748] RPC:       00000000ce702f14 connect status 115 connected 0
      			  sock state 2
      ...
      [  314.916193] RPC:       state 7 conn 0 dead 0 zapped 1 sk_shutdown 3
      [  314.916251] RPC:       xs_connect scheduled xprt 00000000ce702f14
      [  314.916282] RPC:       xs_bind 0.0.0.0:936: ok (0)
      [  314.916292] RPC:       worker connecting xprt 00000000ce702f14 via tcp
      			  to 10.101.1.30 (port 2049)
      [  314.916342] RPC:       00000000ce702f14 connect status 115 connected 0
      			  sock state 2
      
      Fixes: 7c81e6a9
      
       ("SUNRPC: Tweak TCP socket shutdown in the RPC client")
      Signed-off-by: default avatarSiddharth Rajendra Kawar <sikawar@microsoft.com>
      Signed-off-by: default avatarAnna Schumaker <Anna.Schumaker@Netapp.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      c5a159d5
    • Arseniy Krasnov's avatar
      mtd: rawnand: meson: invalidate cache on polling ECC bit · 43b70c9c
      Arseniy Krasnov authored
      [ Upstream commit e732e39e ]
      
      'info_buf' memory is cached and driver polls ECC bit in it. This bit
      is set by the NAND controller. If 'usleep_range()' returns before device
      sets this bit, 'info_buf' will be cached and driver won't see update of
      this bit and will loop forever.
      
      Fixes: 8fae856c
      
       ("mtd: rawnand: meson: add support for Amlogic NAND flash controller")
      Signed-off-by: default avatarArseniy Krasnov <AVKrasnov@sberdevices.ru>
      Reviewed-by: default avatarNeil Armstrong <neil.armstrong@linaro.org>
      Signed-off-by: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
      Link: https://lore.kernel.org/linux-mtd/d4ef0bd6-816e-f6fa-9385-f05f775f0ae2@sberdevices.ru
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      43b70c9c
    • Liang He's avatar
      platform/surface: aggregator: Add missing fwnode_handle_put() · 53dc0b69
      Liang He authored
      [ Upstream commit acd0acb8 ]
      
      In fwnode_for_each_child_node(), we should add
      fwnode_handle_put() when break out of the iteration
      fwnode_for_each_child_node() as it will automatically
      increase and decrease the refcounter.
      
      Fixes: fc622b3d
      
       ("platform/surface: Set up Surface Aggregator device registry")
      Signed-off-by: default avatarLiang He <windhl@126.com>
      Reviewed-by: default avatarMaximilian Luz <luzmaximilian@gmail.com>
      Link: https://lore.kernel.org/r/20230322033057.1855741-1-windhl@126.com
      Reviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      53dc0b69
    • Mark Pearson's avatar
      platform/x86: think-lmi: Add possible_values for ThinkStation · f0a67ad7
      Mark Pearson authored
      [ Upstream commit 8a02d706 ]
      
      ThinkStation platforms don't support the API to return possible_values
      but instead embed it in the settings string.
      
      Try and extract this information and set the possible_values attribute
      appropriately.
      
      Fixes: a40cd7ef
      
       ("platform/x86: think-lmi: Add WMI interface support on Lenovo platforms")
      Signed-off-by: default avatarMark Pearson <mpearson-lenovo@squebb.ca>
      Link: https://lore.kernel.org/r/20230320003221.561750-4-mpearson-lenovo@squebb.ca
      Reviewed-by: default avatarThomas Weißschuh <linux@weissschuh.net>
      Reviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      f0a67ad7
    • Mark Pearson's avatar
      platform/x86: think-lmi: only display possible_values if available · 5b2e50d8
      Mark Pearson authored
      [ Upstream commit cf337f27 ]
      
      Some attributes don't have any values available. In those cases don't
      make the possible_values entry visible.
      
      Fixes: a40cd7ef
      
       ("platform/x86: think-lmi: Add WMI interface support on Lenovo platforms")
      Signed-off-by: default avatarMark Pearson <mpearson-lenovo@squebb.ca>
      Link: https://lore.kernel.org/r/20230320003221.561750-3-mpearson-lenovo@squebb.ca
      Reviewed-by: default avatarThomas Weißschuh <linux@weissschuh.net>
      Reviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      5b2e50d8
    • Mark Pearson's avatar
      platform/x86: think-lmi: use correct possible_values delimiters · 3991efd0
      Mark Pearson authored
      [ Upstream commit 45e21289
      
       ]
      
      firmware-attributes class requires that possible values are delimited
      using ';' but the Lenovo firmware uses ',' instead.
      Parse string and replace where appropriate.
      
      Suggested-by: default avatarThomas Weißschuh <linux@weissschuh.net>
      Fixes: a40cd7ef
      
       ("platform/x86: think-lmi: Add WMI interface support on Lenovo platforms")
      Signed-off-by: default avatarMark Pearson <mpearson-lenovo@squebb.ca>
      Link: https://lore.kernel.org/r/20230320003221.561750-2-mpearson-lenovo@squebb.ca
      Reviewed-by: default avatarThomas Weißschuh <linux@weissschuh.net>
      Reviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      3991efd0
    • Mark Pearson's avatar
      platform/x86: think-lmi: add missing type attribute · 6c69f1ab
      Mark Pearson authored
      [ Upstream commit 583329dc ]
      
      This driver was missing the mandatory type attribute...oops.
      
      Add it in along with logic to determine whether the attribute is an
      enumeration type or a string by parsing the possible_values attribute.
      
      Upstream bug https://bugzilla.kernel.org/show_bug.cgi?id=216460
      
      Fixes: a40cd7ef
      
       ("platform/x86: think-lmi: Add WMI interface support on Lenovo platforms")
      Signed-off-by: default avatarMark Pearson <mpearson-lenovo@squebb.ca>
      Link: https://lore.kernel.org/r/20230320003221.561750-1-mpearson-lenovo@squebb.ca
      Reviewed-by: default avatarThomas Weißschuh <linux@weissschuh.net>
      Reviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      6c69f1ab
    • Yoshihiro Shimoda's avatar
      PCI: dwc: Fix PORT_LINK_CONTROL update when CDM check enabled · ba85e83f
      Yoshihiro Shimoda authored
      [ Upstream commit cdce6709 ]
      
      If CDM_CHECK is enabled (by the DT "snps,enable-cdm-check" property), 'val'
      is overwritten by PCIE_PL_CHK_REG_CONTROL_STATUS initialization.  Commit
      ec7b952f ("PCI: dwc: Always enable CDM check if "snps,enable-cdm-check"
      exists") did not account for further usage of 'val', so we wrote improper
      values to PCIE_PORT_LINK_CONTROL when the CDM check is enabled.
      
      Move the PCIE_PORT_LINK_CONTROL update to be completely after the
      PCIE_PL_CHK_REG_CONTROL_STATUS register initialization.
      
      [bhelgaas: commit log adapted from Serge's version]
      Fixes: ec7b952f
      
       ("PCI: dwc: Always enable CDM check if "snps,enable-cdm-check" exists")
      Link: https://lore.kernel.org/r/20230310123510.675685-2-yoshihiro.shimoda.uh@renesas.com
      Signed-off-by: default avatarYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      Reviewed-by: default avatarSerge Semin <fancer.lancer@gmail.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      ba85e83f
    • Takashi Iwai's avatar
      ALSA: usb-audio: Fix recursive locking at XRUN during syncing · e39afd60
      Takashi Iwai authored
      [ Upstream commit 8c721c53 ]
      
      The recent support of low latency playback in USB-audio driver made
      the snd_usb_queue_pending_output_urbs() function to be called via PCM
      ack ops.  In the new code path, the function is performed already in
      the PCM stream lock.  The problem is that, when an XRUN is detected,
      the function calls snd_pcm_xrun() to notify, but snd_pcm_xrun() is
      supposed to be called only outside the stream lock.  As a result, it
      leads to a deadlock of PCM stream locking.
      
      For avoiding such a recursive locking, this patch adds an additional
      check to the code paths in PCM core that call the ack callback; now it
      checks the error code from the callback, and if it's -EPIPE, the XRUN
      is handled in the PCM core side gracefully.  Along with it, the
      USB-audio driver code is changed to follow that, i.e. -EPIPE is
      returned instead of the explicit snd_pcm_xrun() call when the function
      is performed already in the stream lock.
      
      Fixes: d5f871f8
      
       ("ALSA: usb-audio: Improved lowlatency playback support")
      Reported-and-tested-by: default avatarJohn Keeping <john@metanate.com>
      Link: https://lore.kernel.org/r/20230317195128.3911155-1-john@metanate.com
      Reviewed-by: default avatarJaroslav Kysela <perex@perex.cz>
      Reviewed-by; Takashi Sakamoto <o-takashi@sakamocchi.jp>
      Link: https://lore.kernel.org/r/20230320142838.494-1-tiwai@suse.de
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      e39afd60
    • Álvaro Fernández Rojas's avatar
      mips: bmips: BCM6358: disable RAC flush for TP1 · 2cdbcff9
      Álvaro Fernández Rojas authored
      [ Upstream commit ab327f8a ]
      
      RAC flush causes kernel panics on BCM6358 with EHCI/OHCI when booting from TP1:
      [    3.881739] usb 1-1: new high-speed USB device number 2 using ehci-platform
      [    3.895011] Reserved instruction in kernel code[#1]:
      [    3.900113] CPU: 0 PID: 1 Comm: init Not tainted 5.10.16 #0
      [    3.905829] $ 0   : 00000000 10008700 00000000 77d94060
      [    3.911238] $ 4   : 7fd1f088 00000000 81431cac 81431ca0
      [    3.916641] $ 8   : 00000000 ffffefff 8075cd34 00000000
      [    3.922043] $12   : 806f8d40 f3e812b7 00000000 000d9aaa
      [    3.927446] $16   : 7fd1f068 7fd1f080 7ff559b8 81428470
      [    3.932848] $20   : 00000000 00000000 55590000 77d70000
      [    3.938251] $24   : 00000018 00000010
      [    3.943655] $28   : 81430000 81431e60 81431f28 800157fc
      [    3.949058] Hi    : 00000000
      [    3.952013] Lo    : 00000000
      [    3.955019] epc   : 80015808 setup_sigcontext+0x54/0x24c
      [    3.960464] ra    : 800157fc setup_sigcontext+0x48/0x24c
      [    3.965913] Status: 10008703	KERNEL EXL IE
      [    3.970216] Cause : 00800028 (ExcCode 0a)
      [    3.974340] PrId  : 0002a010 (Broadcom BMIPS4350)
      [    3.979170] Modules linked in: ohci_platform ohci_hcd fsl_mph_dr_of ehci_platform ehci_fsl ehci_hcd gpio_button_hotplug usbcore nls_base usb_common
      [    3.992907] Process init (pid: 1, threadinfo=(ptrval), task=(ptrval), tls=77e22ec8)
      [    4.000776] Stack : 81431ef4 7fd1f080 81431f28 81428470 7fd1f068 81431edc 7ff559b8 81428470
      [    4.009467]         81431f28 7fd1f080 55590000 77d70000 77d5498c 80015c70 806f0000 8063ae74
      [    4.018149]         08100002 81431f28 0000000a 08100002 81431f28 0000000a 77d6b418 00000003
      [    4.026831]         ffffffff 80016414 80080734 81431ecc 81431ecc 00000001 00000000 04000000
      [    4.035512]         77d54874 00000000 00000000 00000000 00000000 00000012 00000002 00000000
      [    4.044196]         ...
      [    4.046706] Call Trace:
      [    4.049238] [<80015808>] setup_sigcontext+0x54/0x24c
      [    4.054356] [<80015c70>] setup_frame+0xdc/0x124
      [    4.059015] [<80016414>] do_notify_resume+0x1dc/0x288
      [    4.064207] [<80011b50>] work_notifysig+0x10/0x18
      [    4.069036]
      [    4.070538] Code: 8fc300b4  00001025  26240008 <ac820000> ac830004  3c048063  0c0228aa  24846a00  26240010
      [    4.080686]
      [    4.082517] ---[ end trace 22a8edb41f5f983b ]---
      [    4.087374] Kernel panic - not syncing: Fatal exception
      [    4.092753] Rebooting in 1 seconds..
      
      Because the bootloader (CFE) is not initializing the Read-ahead cache properly
      on the second thread (TP1). Since the RAC was not initialized properly, we
      should avoid flushing it at the risk of corrupting the instruction stream as
      seen in the trace above.
      
      Fixes: d59098a0
      
       ("MIPS: bmips: use generic dma noncoherent ops")
      Signed-off-by: default avatarÁlvaro Fernández Rojas <noltari@gmail.com>
      Signed-off-by: default avatarThomas Bogendoerfer <tsbogend@alpha.franken.de>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      2cdbcff9
    • Rajnesh Kanwal's avatar
      riscv/kvm: Fix VM hang in case of timer delta being zero. · a07cf4fd
      Rajnesh Kanwal authored
      [ Upstream commit 6eff3804 ]
      
      In case when VCPU is blocked due to WFI, we schedule the timer
      from `kvm_riscv_vcpu_timer_blocking()` to keep timer interrupt
      ticking.
      
      But in case when delta_ns comes to be zero, we never schedule
      the timer and VCPU keeps sleeping indefinitely until any activity
      is done with VM console.
      
      This is easily reproduce-able using kvmtool.
      ./lkvm-static run -c1 --console virtio -p "earlycon root=/dev/vda" \
               -k ./Image -d rootfs.ext4
      
      Also, just add a print in kvm_riscv_vcpu_vstimer_expired() to
      check the interrupt delivery and run `top` or similar auto-upating
      cmd from guest. Within sometime one can notice that print from
      timer expiry routine stops and the `top` cmd output will stop
      updating.
      
      This change fixes this by making sure we schedule the timer even
      with delta_ns being zero to bring the VCPU out of sleep immediately.
      
      Fixes: 8f5cb44b
      
       ("RISC-V: KVM: Support sstc extension")
      Signed-off-by: default avatarRajnesh Kanwal <rkanwal@rivosinc.com>
      Reviewed-by: default avatarAtish Patra <atishp@rivosinc.com>
      Signed-off-by: default avatarAnup Patel <anup@brainfault.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      a07cf4fd
    • Harshit Mogalapalli's avatar
      ca8210: Fix unsigned mac_len comparison with zero in ca8210_skb_tx() · 60b20270
      Harshit Mogalapalli authored
      [ Upstream commit 748b2f5e ]
      
      mac_len is of type unsigned, which can never be less than zero.
      
      	mac_len = ieee802154_hdr_peek_addrs(skb, &header);
      	if (mac_len < 0)
      		return mac_len;
      
      Change this to type int as ieee802154_hdr_peek_addrs() can return negative
      integers, this is found by static analysis with smatch.
      
      Fixes: 6c993779
      
       ("ca8210: fix mac_len negative array access")
      Signed-off-by: default avatarHarshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
      Acked-by: default avatarAlexander Aring <aahringo@redhat.com>
      Reviewed-by: default avatarSimon Horman <simon.horman@corigine.com>
      Link: https://lore.kernel.org/r/20230306191824.4115839-1-harshit.m.mogalapalli@oracle.com
      Signed-off-by: default avatarStefan Schmidt <stefan@datenfreihafen.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      60b20270
    • Christophe JAILLET's avatar
      mtd: nand: mxic-ecc: Fix mxic_ecc_data_xfer_wait_for_completion() when irq is used · 8b46440d
      Christophe JAILLET authored
      [ Upstream commit 75dce6a9 ]
      
      wait_for_completion_timeout() and readl_poll_timeout() don't handle their
      return value the same way.
      
      wait_for_completion_timeout() returns 0 on time out (and >0 in all other
      cases)
      readl_poll_timeout() returns 0 on success and -ETIMEDOUT upon a timeout.
      
      In order for the error handling path to work in both cases, the logic
      against wait_for_completion_timeout() needs to be inverted.
      
      Fixes: 48e6633a
      
       ("mtd: nand: mxic-ecc: Add Macronix external ECC engine support")
      Signed-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
      Signed-off-by: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
      Link: https://lore.kernel.org/linux-mtd/beddbc374557e44ceec897e68c4a5d12764ddbb9.1676459308.git.christophe.jaillet@wanadoo.fr
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      8b46440d
    • Arseniy Krasnov's avatar
      mtd: rawnand: meson: initialize struct with zeroes · c84d28b3
      Arseniy Krasnov authored
      [ Upstream commit 4ce341de ]
      
      This structure must be zeroed, because it's field 'hw->core' is used as
      'parent' in 'clk_core_fill_parent_index()', but it will be uninitialized.
      This happens, because when this struct is not zeroed, pointer 'hw' is
      "initialized" by garbage, which is valid pointer, but points to some
      garbage. So 'hw' will be dereferenced, but 'core' contains some random
      data which will be interpreted as a pointer. The following backtrace is
      result of dereference of such pointer:
      
      [    1.081319]  __clk_register+0x414/0x820
      [    1.085113]  devm_clk_register+0x64/0xd0
      [    1.088995]  meson_nfc_probe+0x258/0x6ec
      [    1.092875]  platform_probe+0x70/0xf0
      [    1.096498]  really_probe+0xc8/0x3e0
      [    1.100034]  __driver_probe_device+0x84/0x190
      [    1.104346]  driver_probe_device+0x44/0x120
      [    1.108487]  __driver_attach+0xb4/0x220
      [    1.112282]  bus_for_each_dev+0x78/0xd0
      [    1.116077]  driver_attach+0x2c/0x40
      [    1.119613]  bus_add_driver+0x184/0x240
      [    1.123408]  driver_register+0x80/0x140
      [    1.127203]  __platform_driver_register+0x30/0x40
      [    1.131860]  meson_nfc_driver_init+0x24/0x30
      
      Fixes: 1e4d3ba6
      
       ("mtd: rawnand: meson: fix the clock")
      Signed-off-by: default avatarArseniy Krasnov <AVKrasnov@sberdevices.ru>
      Acked-by: default avatarMartin Blumenstingl <martin.blumenstingl@googlemail.com>
      Reviewed-by: default avatarNeil Armstrong <neil.armstrong@linaro.org>
      Signed-off-by: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
      Link: https://lore.kernel.org/linux-mtd/20230227102425.793841-1-AVKrasnov@sberdevices.ru
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      c84d28b3
    • Josef Bacik's avatar
      btrfs: use temporary variable for space_info in btrfs_update_block_group · f5527b3b
      Josef Bacik authored
      [ Upstream commit df384da5
      
       ]
      
      We do
      
        cache->space_info->counter += num_bytes;
      
      everywhere in here.  This is makes the lines longer than they need to
      be, and will be especially noticeable when we add the active tracking in,
      so add a temp variable for the space_info so this is cleaner.
      
      Reviewed-by: default avatarNaohiro Aota <naohiro.aota@wdc.com>
      Reviewed-by: default avatarJohannes Thumshirn <johannes.thumshirn@wdc.com>
      Reviewed-by: default avatarAnand Jain <anand.jain@oracle.com>
      Signed-off-by: default avatarJosef Bacik <josef@toxicpanda.com>
      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>
      f5527b3b
    • Josef Bacik's avatar
      btrfs: fix uninitialized variable warning in btrfs_update_block_group · bd265f20
      Josef Bacik authored
      [ Upstream commit efbf35a1
      
       ]
      
      reclaim isn't set in the alloc case, however we only care about
      reclaim in the !alloc case.  This isn't an actual problem, however
      -Wmaybe-uninitialized will complain, so initialize reclaim to quiet the
      compiler.
      
      Reviewed-by: default avatarQu Wenruo <wqu@suse.com>
      Reviewed-by: default avatarJohannes Thumshirn <johannes.thumshirn@wdc.com>
      Signed-off-by: default avatarJosef Bacik <josef@toxicpanda.com>
      Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      Stable-dep-of: df384da5
      
       ("btrfs: use temporary variable for space_info in btrfs_update_block_group")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      bd265f20
    • Anton Gusev's avatar
      tracing: Fix wrong return in kprobe_event_gen_test.c · 089d6569
      Anton Gusev authored
      [ Upstream commit bc4f359b ]
      
      Overwriting the error code with the deletion result may cause the
      function to return 0 despite encountering an error. Commit b111545d
      
      
      ("tracing: Remove the useless value assignment in
      test_create_synth_event()") solves a similar issue by
      returning the original error code, so this patch does the same.
      
      Found by Linux Verification Center (linuxtesting.org) with SVACE.
      
      Link: https://lore.kernel.org/linux-trace-kernel/20230131075818.5322-1-aagusev@ispras.ru
      
      Signed-off-by: default avatarAnton Gusev <aagusev@ispras.ru>
      Reviewed-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
      Acked-by: default avatarMasami Hiramatsu (Google) <mhiramat@kernel.org>
      Signed-off-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      089d6569
    • Antti Laakso's avatar
      tools/power turbostat: fix decoding of HWP_STATUS · 88cdf1d8
      Antti Laakso authored
      [ Upstream commit 92c25393
      
       ]
      
      The "excursion to minimum" information is in bit2
      in HWP_STATUS MSR. Fix the bitmask used for
      decoding the register.
      
      Signed-off-by: default avatarAntti Laakso <antti.laakso@intel.com>
      Reviewed-by: default avatarArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
      Signed-off-by: default avatarLen Brown <len.brown@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      88cdf1d8
    • Prarit Bhargava's avatar
      tools/power turbostat: Fix /dev/cpu_dma_latency warnings · 6ecdea91
      Prarit Bhargava authored
      [ Upstream commit 40aafc7d
      
       ]
      
      When running as non-root the following error is seen in turbostat:
      
      turbostat: fopen /dev/cpu_dma_latency
      : Permission denied
      
      turbostat and the man page have information on how to avoid other
      permission errors, so these can be fixed the same way.
      
      Provide better /dev/cpu_dma_latency warnings that provide instructions on
      how to avoid the error, and update the man page.
      
      Signed-off-by: default avatarPrarit Bhargava <prarit@redhat.com>
      Cc: linux-pm@vger.kernel.org
      Signed-off-by: default avatarLen Brown <len.brown@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      6ecdea91
    • Wei Chen's avatar
      fbdev: au1200fb: Fix potential divide by zero · 2a3562ea
      Wei Chen authored
      [ Upstream commit 44a3b36b
      
       ]
      
      var->pixclock can be assigned to zero by user. Without
      proper check, divide by zero would occur when invoking
      macro PICOS2KHZ in au1200fb_fb_check_var.
      
      Error out if var->pixclock is zero.
      
      Signed-off-by: default avatarWei Chen <harperchen1110@gmail.com>
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      2a3562ea
    • Wei Chen's avatar
      fbdev: lxfb: Fix potential divide by zero · 9f2a69d5
      Wei Chen authored
      [ Upstream commit 61ac4b86
      
       ]
      
      var->pixclock can be assigned to zero by user. Without proper
      check, divide by zero would occur in lx_set_clock.
      
      Error out if var->pixclock is zero.
      
      Signed-off-by: default avatarWei Chen <harperchen1110@gmail.com>
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      9f2a69d5
    • Wei Chen's avatar
      fbdev: intelfb: Fix potential divide by zero · 8ab9eada
      Wei Chen authored
      [ Upstream commit d8236854
      
       ]
      
      Variable var->pixclock is controlled by user and can be assigned
      to zero. Without proper check, divide by zero would occur in
      intelfbhw_validate_mode and intelfbhw_mode_to_hw.
      
      Error out if var->pixclock is zero.
      
      Signed-off-by: default avatarWei Chen <harperchen1110@gmail.com>
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      8ab9eada