Skip to content
  1. Feb 16, 2022
    • Louis Peens's avatar
      nfp: flower: fix ida_idx not being released · 0bae953d
      Louis Peens authored
      [ Upstream commit 7db788ad ]
      
      When looking for a global mac index the extra NFP_TUN_PRE_TUN_IDX_BIT
      that gets set if nfp_flower_is_supported_bridge is true is not taken
      into account. Consequently the path that should release the ida_index
      in cleanup is never triggered, causing messages like:
      
          nfp 0000:02:00.0: nfp: Failed to offload MAC on br-ex.
          nfp 0000:02:00.0: nfp: Failed to offload MAC on br-ex.
          nfp 0000:02:00.0: nfp: Failed to offload MAC on br-ex.
      
      after NFP_MAX_MAC_INDEX number of reconfigs. Ultimately this lead to
      new tunnel flows not being offloaded.
      
      Fix this by unsetting the NFP_TUN_PRE_TUN_IDX_BIT before checking if
      the port is of type OTHER.
      
      Fixes: 2e0bc7f3
      
       ("nfp: flower: encode mac indexes with pre-tunnel rule check")
      Signed-off-by: default avatarLouis Peens <louis.peens@corigine.com>
      Signed-off-by: default avatarSimon Horman <simon.horman@corigine.com>
      Link: https://lore.kernel.org/r/20220208101453.321949-1-simon.horman@corigine.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      0bae953d
    • Eric Dumazet's avatar
      ipmr,ip6mr: acquire RTNL before calling ip[6]mr_free_table() on failure path · 09ac0fcb
      Eric Dumazet authored
      [ Upstream commit 5611a006 ]
      
      ip[6]mr_free_table() can only be called under RTNL lock.
      
      RTNL: assertion failed at net/core/dev.c (10367)
      WARNING: CPU: 1 PID: 5890 at net/core/dev.c:10367 unregister_netdevice_many+0x1246/0x1850 net/core/dev.c:10367
      Modules linked in:
      CPU: 1 PID: 5890 Comm: syz-executor.2 Not tainted 5.16.0-syzkaller-11627-g422ee58dc0ef #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
      RIP: 0010:unregister_netdevice_many+0x1246/0x1850 net/core/dev.c:10367
      Code: 0f 85 9b ee ff ff e8 69 07 4b fa ba 7f 28 00 00 48 c7 c6 00 90 ae 8a 48 c7 c7 40 90 ae 8a c6 05 6d b1 51 06 01 e8 8c 90 d8 01 <0f> 0b e9 70 ee ff ff e8 3e 07 4b fa 4c 89 e7 e8 86 2a 59 fa e9 ee
      RSP: 0018:ffffc900046ff6e0 EFLAGS: 00010286
      RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000
      RDX: ffff888050f51d00 RSI: ffffffff815fa008 RDI: fffff520008dfece
      RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000
      R10: ffffffff815f3d6e R11: 0000000000000000 R12: 00000000fffffff4
      R13: dffffc0000000000 R14: ffffc900046ff750 R15: ffff88807b7dc000
      FS:  00007f4ab736e700(0000) GS:ffff8880b9d00000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 00007fee0b4f8990 CR3: 000000001e7d2000 CR4: 00000000003506e0
      DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      Call Trace:
       <TASK>
       mroute_clean_tables+0x244/0xb40 net/ipv6/ip6mr.c:1509
       ip6mr_free_table net/ipv6/ip6mr.c:389 [inline]
       ip6mr_rules_init net/ipv6/ip6mr.c:246 [inline]
       ip6mr_net_init net/ipv6/ip6mr.c:1306 [inline]
       ip6mr_net_init+0x3f0/0x4e0 net/ipv6/ip6mr.c:1298
       ops_init+0xaf/0x470 net/core/net_namespace.c:140
       setup_net+0x54f/0xbb0 net/core/net_namespace.c:331
       copy_net_ns+0x318/0x760 net/core/net_namespace.c:475
       create_new_namespaces+0x3f6/0xb20 kernel/nsproxy.c:110
       copy_namespaces+0x391/0x450 kernel/nsproxy.c:178
       copy_process+0x2e0c/0x7300 kernel/fork.c:2167
       kernel_clone+0xe7/0xab0 kernel/fork.c:2555
       __do_sys_clone+0xc8/0x110 kernel/fork.c:2672
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x44/0xae
      RIP: 0033:0x7f4ab89f9059
      Code: Unable to access opcode bytes at RIP 0x7f4ab89f902f.
      RSP: 002b:00007f4ab736e118 EFLAGS: 00000206 ORIG_RAX: 0000000000000038
      RAX: ffffffffffffffda RBX: 00007f4ab8b0bf60 RCX: 00007f4ab89f9059
      RDX: 0000000020000280 RSI: 0000000020000270 RDI: 0000000040200000
      RBP: 00007f4ab8a5308d R08: 0000000020000300 R09: 0000000020000300
      R10: 00000000200002c0 R11: 0000000000000206 R12: 0000000000000000
      R13: 00007ffc3977cc1f R14: 00007f4ab736e300 R15: 0000000000022000
       </TASK>
      
      Fixes: f243e5a7
      
       ("ipmr,ip6mr: call ip6mr_free_table() on failure path")
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Cc: Cong Wang <cong.wang@bytedance.com>
      Reported-by: default avatarsyzbot <syzkaller@googlegroups.com>
      Link: https://lore.kernel.org/r/20220208053451.2885398-1-eric.dumazet@gmail.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      09ac0fcb
    • Vladimir Oltean's avatar
      net: dsa: lantiq_gswip: don't use devres for mdiobus · e177d2e8
      Vladimir Oltean authored
      [ Upstream commit 0d120dfb ]
      
      As explained in commits:
      74b6d7d1 ("net: dsa: realtek: register the MDIO bus under devres")
      5135e96a ("net: dsa: don't allocate the slave_mii_bus using devres")
      
      mdiobus_free() will panic when called from devm_mdiobus_free() <-
      devres_release_all() <- __device_release_driver(), and that mdiobus was
      not previously unregistered.
      
      The GSWIP switch is a platform device, so the initial set of constraints
      that I thought would cause this (I2C or SPI buses which call ->remove on
      ->shutdown) do not apply. But there is one more which applies here.
      
      If the DSA master itself is on a bus that calls ->remove from ->shutdown
      (like dpaa2-eth, which is on the fsl-mc bus), there is a device link
      between the switch and the DSA master, and device_links_unbind_consumers()
      will unbind the GSWIP switch driver on shutdown.
      
      So the same treatment must be applied to all DSA switch drivers, which
      is: either use devres for both the mdiobus allocation and registration,
      or don't use devres at all.
      
      The gswip driver has the code structure in place for orderly mdiobus
      removal, so just replace devm_mdiobus_alloc() with the non-devres
      variant, and add manual free where necessary, to ensure that we don't
      let devres free a still-registered bus.
      
      Fixes: ac3a68d5
      
       ("net: phy: don't abuse devres in devm_mdiobus_register()")
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      e177d2e8
    • Vladimir Oltean's avatar
      net: dsa: felix: don't use devres for mdiobus · 95e5402f
      Vladimir Oltean authored
      [ Upstream commit 209bdb7e ]
      
      As explained in commits:
      74b6d7d1 ("net: dsa: realtek: register the MDIO bus under devres")
      5135e96a ("net: dsa: don't allocate the slave_mii_bus using devres")
      
      mdiobus_free() will panic when called from devm_mdiobus_free() <-
      devres_release_all() <- __device_release_driver(), and that mdiobus was
      not previously unregistered.
      
      The Felix VSC9959 switch is a PCI device, so the initial set of
      constraints that I thought would cause this (I2C or SPI buses which call
      ->remove on ->shutdown) do not apply. But there is one more which
      applies here.
      
      If the DSA master itself is on a bus that calls ->remove from ->shutdown
      (like dpaa2-eth, which is on the fsl-mc bus), there is a device link
      between the switch and the DSA master, and device_links_unbind_consumers()
      will unbind the felix switch driver on shutdown.
      
      So the same treatment must be applied to all DSA switch drivers, which
      is: either use devres for both the mdiobus allocation and registration,
      or don't use devres at all.
      
      The felix driver has the code structure in place for orderly mdiobus
      removal, so just replace devm_mdiobus_alloc_size() with the non-devres
      variant, and add manual free where necessary, to ensure that we don't
      let devres free a still-registered bus.
      
      Fixes: ac3a68d5
      
       ("net: phy: don't abuse devres in devm_mdiobus_register()")
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      95e5402f
    • Vladimir Oltean's avatar
      net: dsa: bcm_sf2: don't use devres for mdiobus · 2770b795
      Vladimir Oltean authored
      [ Upstream commit 08f1a208 ]
      
      As explained in commits:
      74b6d7d1 ("net: dsa: realtek: register the MDIO bus under devres")
      5135e96a ("net: dsa: don't allocate the slave_mii_bus using devres")
      
      mdiobus_free() will panic when called from devm_mdiobus_free() <-
      devres_release_all() <- __device_release_driver(), and that mdiobus was
      not previously unregistered.
      
      The Starfighter 2 is a platform device, so the initial set of
      constraints that I thought would cause this (I2C or SPI buses which call
      ->remove on ->shutdown) do not apply. But there is one more which
      applies here.
      
      If the DSA master itself is on a bus that calls ->remove from ->shutdown
      (like dpaa2-eth, which is on the fsl-mc bus), there is a device link
      between the switch and the DSA master, and device_links_unbind_consumers()
      will unbind the bcm_sf2 switch driver on shutdown.
      
      So the same treatment must be applied to all DSA switch drivers, which
      is: either use devres for both the mdiobus allocation and registration,
      or don't use devres at all.
      
      The bcm_sf2 driver has the code structure in place for orderly mdiobus
      removal, so just replace devm_mdiobus_alloc() with the non-devres
      variant, and add manual free where necessary, to ensure that we don't
      let devres free a still-registered bus.
      
      Fixes: ac3a68d5
      
       ("net: phy: don't abuse devres in devm_mdiobus_register()")
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      2770b795
    • Vladimir Oltean's avatar
      net: dsa: ar9331: register the mdiobus under devres · 475ce5dc
      Vladimir Oltean authored
      [ Upstream commit 50facd86 ]
      
      As explained in commits:
      74b6d7d1 ("net: dsa: realtek: register the MDIO bus under devres")
      5135e96a ("net: dsa: don't allocate the slave_mii_bus using devres")
      
      mdiobus_free() will panic when called from devm_mdiobus_free() <-
      devres_release_all() <- __device_release_driver(), and that mdiobus was
      not previously unregistered.
      
      The ar9331 is an MDIO device, so the initial set of constraints that I
      thought would cause this (I2C or SPI buses which call ->remove on
      ->shutdown) do not apply. But there is one more which applies here.
      
      If the DSA master itself is on a bus that calls ->remove from ->shutdown
      (like dpaa2-eth, which is on the fsl-mc bus), there is a device link
      between the switch and the DSA master, and device_links_unbind_consumers()
      will unbind the ar9331 switch driver on shutdown.
      
      So the same treatment must be applied to all DSA switch drivers, which
      is: either use devres for both the mdiobus allocation and registration,
      or don't use devres at all.
      
      The ar9331 driver doesn't have a complex code structure for mdiobus
      removal, so just replace of_mdiobus_register with the devres variant in
      order to be all-devres and ensure that we don't free a still-registered
      bus.
      
      Fixes: ac3a68d5
      
       ("net: phy: don't abuse devres in devm_mdiobus_register()")
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Tested-by: default avatarOleksij Rempel <o.rempel@pengutronix.de>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      475ce5dc
    • Vladimir Oltean's avatar
      net: dsa: mv88e6xxx: don't use devres for mdiobus · 8ccebe77
      Vladimir Oltean authored
      [ Upstream commit f53a2ce8 ]
      
      As explained in commits:
      74b6d7d1 ("net: dsa: realtek: register the MDIO bus under devres")
      5135e96a ("net: dsa: don't allocate the slave_mii_bus using devres")
      
      mdiobus_free() will panic when called from devm_mdiobus_free() <-
      devres_release_all() <- __device_release_driver(), and that mdiobus was
      not previously unregistered.
      
      The mv88e6xxx is an MDIO device, so the initial set of constraints that
      I thought would cause this (I2C or SPI buses which call ->remove on
      ->shutdown) do not apply. But there is one more which applies here.
      
      If the DSA master itself is on a bus that calls ->remove from ->shutdown
      (like dpaa2-eth, which is on the fsl-mc bus), there is a device link
      between the switch and the DSA master, and device_links_unbind_consumers()
      will unbind the Marvell switch driver on shutdown.
      
      systemd-shutdown[1]: Powering off.
      mv88e6085 0x0000000008b96000:00 sw_gl0: Link is Down
      fsl-mc dpbp.9: Removing from iommu group 7
      fsl-mc dpbp.8: Removing from iommu group 7
      ------------[ cut here ]------------
      kernel BUG at drivers/net/phy/mdio_bus.c:677!
      Internal error: Oops - BUG: 0 [#1] PREEMPT SMP
      Modules linked in:
      CPU: 0 PID: 1 Comm: systemd-shutdow Not tainted 5.16.5-00040-gdc05f73788e5 #15
      pc : mdiobus_free+0x44/0x50
      lr : devm_mdiobus_free+0x10/0x20
      Call trace:
       mdiobus_free+0x44/0x50
       devm_mdiobus_free+0x10/0x20
       devres_release_all+0xa0/0x100
       __device_release_driver+0x190/0x220
       device_release_driver_internal+0xac/0xb0
       device_links_unbind_consumers+0xd4/0x100
       __device_release_driver+0x4c/0x220
       device_release_driver_internal+0xac/0xb0
       device_links_unbind_consumers+0xd4/0x100
       __device_release_driver+0x94/0x220
       device_release_driver+0x28/0x40
       bus_remove_device+0x118/0x124
       device_del+0x174/0x420
       fsl_mc_device_remove+0x24/0x40
       __fsl_mc_device_remove+0xc/0x20
       device_for_each_child+0x58/0xa0
       dprc_remove+0x90/0xb0
       fsl_mc_driver_remove+0x20/0x5c
       __device_release_driver+0x21c/0x220
       device_release_driver+0x28/0x40
       bus_remove_device+0x118/0x124
       device_del+0x174/0x420
       fsl_mc_bus_remove+0x80/0x100
       fsl_mc_bus_shutdown+0xc/0x1c
       platform_shutdown+0x20/0x30
       device_shutdown+0x154/0x330
       kernel_power_off+0x34/0x6c
       __do_sys_reboot+0x15c/0x250
       __arm64_sys_reboot+0x20/0x30
       invoke_syscall.constprop.0+0x4c/0xe0
       do_el0_svc+0x4c/0x150
       el0_svc+0x24/0xb0
       el0t_64_sync_handler+0xa8/0xb0
       el0t_64_sync+0x178/0x17c
      
      So the same treatment must be applied to all DSA switch drivers, which
      is: either use devres for both the mdiobus allocation and registration,
      or don't use devres at all.
      
      The Marvell driver already has a good structure for mdiobus removal, so
      just plug in mdiobus_free and get rid of devres.
      
      Fixes: ac3a68d5
      
       ("net: phy: don't abuse devres in devm_mdiobus_register()")
      Reported-by: default avatarRafael Richter <Rafael.Richter@gin.de>
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Tested-by: default avatarDaniel Klauer <daniel.klauer@gin.de>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      8ccebe77
    • Mahesh Bandewar's avatar
      bonding: pair enable_port with slave_arr_updates · 4a384c1e
      Mahesh Bandewar authored
      [ Upstream commit 23de0d7b ]
      
      When 803.2ad mode enables a participating port, it should update
      the slave-array. I have observed that the member links are participating
      and are part of the active aggregator while the traffic is egressing via
      only one member link (in a case where two links are participating). Via
      kprobes I discovered that slave-arr has only one link added while
      the other participating link wasn't part of the slave-arr.
      
      I couldn't see what caused that situation but the simple code-walk
      through provided me hints that the enable_port wasn't always associated
      with the slave-array update.
      
      Fixes: ee637714
      
       ("bonding: Simplify the xmit function for modes that use xmit_hash")
      Signed-off-by: default avatarMahesh Bandewar <maheshb@google.com>
      Acked-by: default avatarJay Vosburgh <jay.vosburgh@canonical.com>
      Link: https://lore.kernel.org/r/20220207222901.1795287-1-maheshb@google.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      4a384c1e
    • Niklas Cassel's avatar
      gpio: sifive: use the correct register to read output values · 1ba45dd3
      Niklas Cassel authored
      [ Upstream commit cc38ef93 ]
      
      Setting the output of a GPIO to 1 using gpiod_set_value(), followed by
      reading the same GPIO using gpiod_get_value(), will currently yield an
      incorrect result.
      
      This is because the SiFive GPIO device stores the output values in reg_set,
      not reg_dat.
      
      Supply the flag BGPIOF_READ_OUTPUT_REG_SET to bgpio_init() so that the
      generic driver reads the correct register.
      
      Fixes: 96868dce
      
       ("gpio/sifive: Add GPIO driver for SiFive SoCs")
      Signed-off-by: default avatarNiklas Cassel <niklas.cassel@wdc.com>
      Reviewed-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      [Bartosz: added the Fixes tag]
      Signed-off-by: default avatarBartosz Golaszewski <brgl@bgdev.pl>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      1ba45dd3
    • Rafael J. Wysocki's avatar
      ACPI: PM: s2idle: Cancel wakeup before dispatching EC GPE · 48e41308
      Rafael J. Wysocki authored
      [ Upstream commit dc0075ba ]
      
      Commit 4a9af6ca ("ACPI: EC: Rework flushing of EC work while
      suspended to idle") made acpi_ec_dispatch_gpe() check
      pm_wakeup_pending(), but that is before canceling the SCI wakeup,
      so pm_wakeup_pending() is always true.  This causes the loop in
      acpi_ec_dispatch_gpe() to always terminate after one iteration which
      may not be correct.
      
      Address this issue by canceling the SCI wakeup earlier, from
      acpi_ec_dispatch_gpe() itself.
      
      Fixes: 4a9af6ca
      
       ("ACPI: EC: Rework flushing of EC work while suspended to idle")
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      48e41308
    • Christoph Niedermaier's avatar
      drm/panel: simple: Assign data from panel_dpi_probe() correctly · 3b72d3f0
      Christoph Niedermaier authored
      [ Upstream commit 6df4432a ]
      
      In the function panel_simple_probe() the pointer panel->desc is
      assigned to the passed pointer desc. If function panel_dpi_probe()
      is called panel->desc will be updated, but further on only desc
      will be evaluated. So update the desc pointer to be able to use
      the data from the function panel_dpi_probe().
      
      Fixes: 4a1d0dbc
      
       ("drm/panel: simple: add panel-dpi support")
      
      Signed-off-by: default avatarChristoph Niedermaier <cniedermaier@dh-electronics.com>
      Cc: Marek Vasut <marex@denx.de>
      Cc: Thierry Reding <thierry.reding@gmail.com>
      Cc: Sam Ravnborg <sam@ravnborg.org>
      Cc: David Airlie <airlied@linux.ie>
      Cc: Daniel Vetter <daniel@ffwll.ch>
      To: dri-devel@lists.freedesktop.org
      Reviewed-by: default avatarSam Ravnborg <sam@ravnborg.org>
      Signed-off-by: default avatarMarek Vasut <marex@denx.de>
      Link: https://patchwork.freedesktop.org/patch/msgid/20220201110153.3479-1-cniedermaier@dh-electronics.com
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      3b72d3f0
    • Samuel Mendoza-Jonas's avatar
      ixgbevf: Require large buffers for build_skb on 82599VF · bf356391
      Samuel Mendoza-Jonas authored
      [ Upstream commit fe68195d ]
      
      From 4.17 onwards the ixgbevf driver uses build_skb() to build an skb
      around new data in the page buffer shared with the ixgbe PF.
      This uses either a 2K or 3K buffer, and offsets the DMA mapping by
      NET_SKB_PAD + NET_IP_ALIGN. When using a smaller buffer RXDCTL is set to
      ensure the PF does not write a full 2K bytes into the buffer, which is
      actually 2K minus the offset.
      
      However on the 82599 virtual function, the RXDCTL mechanism is not
      available. The driver attempts to work around this by using the SET_LPE
      mailbox method to lower the maximm frame size, but the ixgbe PF driver
      ignores this in order to keep the PF and all VFs in sync[0].
      
      This means the PF will write up to the full 2K set in SRRCTL, causing it
      to write NET_SKB_PAD + NET_IP_ALIGN bytes past the end of the buffer.
      With 4K pages split into two buffers, this means it either writes
      NET_SKB_PAD + NET_IP_ALIGN bytes past the first buffer (and into the
      second), or NET_SKB_PAD + NET_IP_ALIGN bytes past the end of the DMA
      mapping.
      
      Avoid this by only enabling build_skb when using "large" buffers (3K).
      These are placed in each half of an order-1 page, preventing the PF from
      writing past the end of the mapping.
      
      [0]: Technically it only ever raises the max frame size, see
      ixgbe_set_vf_lpe() in ixgbe_sriov.c
      
      Fixes: f15c5ba5
      
       ("ixgbevf: add support for using order 1 pages to receive large frames")
      Signed-off-by: default avatarSamuel Mendoza-Jonas <samjonas@amazon.com>
      Tested-by: default avatarKonrad Jankowski <konrad0.jankowski@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      bf356391
    • Dongjin Kim's avatar
      arm64: dts: meson-g12b-odroid-n2: fix typo 'dio2133' · e5a64f54
      Dongjin Kim authored
      [ Upstream commit bc41099f
      
       ]
      
      Typo in audio amplifier node, dioo2133 -> dio2133
      
      Signed-off-by: default avatarDongjin Kim <tobetter@gmail.com>
      Fixes: ef599f5f ("arm64: dts: meson: convert ODROID-N2 to dtsi")
      Fixes: 67d141c1
      
       ("arm64: dts: meson: odroid-n2: add jack audio output support")
      Reviewed-by: default avatarNeil Armstrong <narmstrong@baylibre.com>
      Signed-off-by: default avatarNeil Armstrong <narmstrong@baylibre.com>
      Link: https://lore.kernel.org/r/YfKQJejh0bfGYvof@anyang
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      e5a64f54
    • Florian Westphal's avatar
      netfilter: ctnetlink: disable helper autoassign · 04fe6569
      Florian Westphal authored
      [ Upstream commit d1ca60ef ]
      
      When userspace, e.g. conntrackd, inserts an entry with a specified helper,
      its possible that the helper is lost immediately after its added:
      
      ctnetlink_create_conntrack
        -> nf_ct_helper_ext_add + assign helper
          -> ctnetlink_setup_nat
            -> ctnetlink_parse_nat_setup
               -> parse_nat_setup -> nfnetlink_parse_nat_setup
      	                       -> nf_nat_setup_info
                                       -> nf_conntrack_alter_reply
                                         -> __nf_ct_try_assign_helper
      
      ... and __nf_ct_try_assign_helper will zero the helper again.
      
      Set IPS_HELPER bit to bypass auto-assign logic, its unwanted, just like
      when helper is assigned via ruleset.
      
      Dropped old 'not strictly necessary' comment, it referred to use of
      rcu_assign_pointer() before it got replaced by RCU_INIT_POINTER().
      
      NB: Fixes tag intentionally incorrect, this extends the referenced commit,
      but this change won't build without IPS_HELPER introduced there.
      
      Fixes: 6714cf54
      
       ("netfilter: nf_conntrack: fix explicit helper attachment and NAT")
      Reported-by: default avatarPham Thanh Tuyen <phamtyn@gmail.com>
      Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      04fe6569
    • Mathias Krause's avatar
      misc: fastrpc: avoid double fput() on failed usercopy · a5ce7ee5
      Mathias Krause authored
      [ Upstream commit 46963e2e ]
      
      If the copy back to userland fails for the FASTRPC_IOCTL_ALLOC_DMA_BUFF
      ioctl(), we shouldn't assume that 'buf->dmabuf' is still valid. In fact,
      dma_buf_fd() called fd_install() before, i.e. "consumed" one reference,
      leaving us with none.
      
      Calling dma_buf_put() will therefore put a reference we no longer own,
      leading to a valid file descritor table entry for an already released
      'file' object which is a straight use-after-free.
      
      Simply avoid calling dma_buf_put() and rely on the process exit code to
      do the necessary cleanup, if needed, i.e. if the file descriptor is
      still valid.
      
      Fixes: 6cffd795
      
       ("misc: fastrpc: Add support for dmabuf exporter")
      Acked-by: default avatarChristian König <christian.koenig@amd.com>
      Signed-off-by: default avatarMathias Krause <minipli@grsecurity.net>
      Link: https://lore.kernel.org/r/20220127130218.809261-1-minipli@grsecurity.net
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      a5ce7ee5
    • Dave Stevenson's avatar
      drm/vc4: hdmi: Allow DBLCLK modes even if horz timing is odd. · 21c890ca
      Dave Stevenson authored
      [ Upstream commit 1d118965 ]
      
      The 2711 pixel valve can't produce odd horizontal timings, and
      checks were added to vc4_hdmi_encoder_atomic_check and
      vc4_hdmi_encoder_mode_valid to filter out/block selection of
      such modes.
      
      Modes with DRM_MODE_FLAG_DBLCLK double all the horizontal timing
      values before programming them into the PV. The PV values,
      therefore, can not be odd, and so the modes can be supported.
      
      Amend the filtering appropriately.
      
      Fixes: 57fb32e6
      
       ("drm/vc4: hdmi: Block odd horizontal timings")
      Signed-off-by: default avatarDave Stevenson <dave.stevenson@raspberrypi.com>
      Signed-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
      Link: https://patchwork.freedesktop.org/patch/msgid/20220127135116.298278-1-maxime@cerno.tech
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      21c890ca
    • Geert Uytterhoeven's avatar
      gpio: aggregator: Fix calling into sleeping GPIO controllers · 70ea0056
      Geert Uytterhoeven authored
      [ Upstream commit 2cba0545
      
       ]
      
      If the parent GPIO controller is a sleeping controller (e.g. a GPIO
      controller connected to I2C), getting or setting a GPIO triggers a
      might_sleep() warning.  This happens because the GPIO Aggregator takes
      the can_sleep flag into account only for its internal locking, not for
      calling into the parent GPIO controller.
      
      Fix this by using the gpiod_[gs]et*_cansleep() APIs when calling into a
      sleeping GPIO controller.
      
      Reported-by: default avatarMikko Salomäki <ms@datarespons.se>
      Fixes: 828546e2
      
       ("gpio: Add GPIO Aggregator")
      Signed-off-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
      Reviewed-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
      Signed-off-by: default avatarBartosz Golaszewski <brgl@bgdev.pl>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      70ea0056
    • Udipto Goswami's avatar
      usb: f_fs: Fix use-after-free for epfile · 0042178a
      Udipto Goswami authored
      [ Upstream commit ebe2b1ad ]
      
      Consider a case where ffs_func_eps_disable is called from
      ffs_func_disable as part of composition switch and at the
      same time ffs_epfile_release get called from userspace.
      ffs_epfile_release will free up the read buffer and call
      ffs_data_closed which in turn destroys ffs->epfiles and
      mark it as NULL. While this was happening the driver has
      already initialized the local epfile in ffs_func_eps_disable
      which is now freed and waiting to acquire the spinlock. Once
      spinlock is acquired the driver proceeds with the stale value
      of epfile and tries to free the already freed read buffer
      causing use-after-free.
      
      Following is the illustration of the race:
      
            CPU1                                  CPU2
      
         ffs_func_eps_disable
         epfiles (local copy)
      					ffs_epfile_release
      					ffs_data_closed
      					if (last file closed)
      					ffs_data_reset
      					ffs_data_clear
      					ffs_epfiles_destroy
      spin_lock
      dereference epfiles
      
      Fix this races by taking epfiles local copy & assigning it under
      spinlock and if epfiles(local) is null then update it in ffs->epfiles
      then finally destroy it.
      Extending the scope further from the race, protecting the ep related
      structures, and concurrent accesses.
      
      Fixes: a9e6f83c
      
       ("usb: gadget: f_fs: stop sleeping in ffs_func_eps_disable")
      Co-developed-by: default avatarUdipto Goswami <quic_ugoswami@quicinc.com>
      Reviewed-by: default avatarJohn Keeping <john@metanate.com>
      Signed-off-by: default avatarPratham Pratap <quic_ppratap@quicinc.com>
      Signed-off-by: default avatarUdipto Goswami <quic_ugoswami@quicinc.com>
      Link: https://lore.kernel.org/r/1643256595-10797-1-git-send-email-quic_ugoswami@quicinc.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      0042178a
    • Rob Herring's avatar
      ARM: dts: imx7ulp: Fix 'assigned-clocks-parents' typo · 5a37fd9f
      Rob Herring authored
      [ Upstream commit 6d58c5e2
      
       ]
      
      The correct property name is 'assigned-clock-parents', not
      'assigned-clocks-parents'. Though if the platform works with the typo, one
      has to wonder if the property is even needed.
      
      Signed-off-by: default avatarRob Herring <robh@kernel.org>
      Fixes: 8b8c7d97
      
       ("ARM: dts: imx7ulp: Add wdog1 node")
      Signed-off-by: default avatarShawn Guo <shawnguo@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      5a37fd9f
    • Robert Hancock's avatar
      phy: xilinx: zynqmp: Fix bus width setting for SGMII · 39bf132a
      Robert Hancock authored
      [ Upstream commit 37291f60 ]
      
      TX_PROT_BUS_WIDTH and RX_PROT_BUS_WIDTH are single registers with
      separate bit fields for each lane. The code in xpsgtr_phy_init_sgmii was
      not preserving the existing register value for other lanes, so enabling
      the PHY in SGMII mode on one lane zeroed out the settings for all other
      lanes, causing other PS-GTR peripherals such as USB3 to malfunction.
      
      Use xpsgtr_clr_set to only manipulate the desired bits in the register.
      
      Fixes: 4a33bea0
      
       ("phy: zynqmp: Add PHY driver for the Xilinx ZynqMP Gigabit Transceiver")
      Signed-off-by: default avatarRobert Hancock <robert.hancock@calian.com>
      Acked-by: default avatarMichal Simek <michal.simek@xilinx.com>
      Reviewed-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
      Link: https://lore.kernel.org/r/20220126001600.1592218-1-robert.hancock@calian.com
      Signed-off-by: default avatarVinod Koul <vkoul@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      39bf132a
    • Fabio Estevam's avatar
      ARM: dts: imx6qdl-udoo: Properly describe the SD card detect · 108868da
      Fabio Estevam authored
      [ Upstream commit 993d6614 ]
      
      GPIO7_IO00 is used as SD card detect.
      
      Properly describe this in the devicetree.
      
      Fixes: 40cdaa54
      
       ("ARM: dts: imx6q-udoo: Add initial board support")
      Signed-off-by: default avatarFabio Estevam <festevam@gmail.com>
      Signed-off-by: default avatarShawn Guo <shawnguo@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      108868da
    • Uwe Kleine-König's avatar
      staging: fbtft: Fix error path in fbtft_driver_module_init() · 0a7b5e8d
      Uwe Kleine-König authored
      [ Upstream commit 426aca16 ]
      
      If registering the platform driver fails, the function must not return
      without undoing the spi driver registration first.
      
      Fixes: c296d5f9
      
       ("staging: fbtft: core support")
      Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
      Link: https://lore.kernel.org/r/20220118181338.207943-1-u.kleine-koenig@pengutronix.de
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      0a7b5e8d
    • Martin Blumenstingl's avatar
      ARM: dts: meson8b: Fix the UART device-tree schema validation · 74cd5cb2
      Martin Blumenstingl authored
      [ Upstream commit 3375aa77 ]
      
      The dt-bindings for the UART controller only allow the following values
      for Meson8 SoCs:
      - "amlogic,meson8b-uart", "amlogic,meson-ao-uart"
      - "amlogic,meson8b-uart"
      
      Use the correct fallback compatible string "amlogic,meson-ao-uart" for
      AO UART. Drop the "amlogic,meson-uart" compatible string from the EE
      domain UART controllers.
      
      Also update the order of the clocks to match the order defined in the
      yaml bindings.
      
      Fixes: b02d6e73
      
       ("ARM: dts: meson8b: use stable UART bindings with correct gate clock")
      Signed-off-by: default avatarMartin Blumenstingl <martin.blumenstingl@googlemail.com>
      Signed-off-by: default avatarNeil Armstrong <narmstrong@baylibre.com>
      Link: https://lore.kernel.org/r/20211227180026.4068352-4-martin.blumenstingl@googlemail.com
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      74cd5cb2
    • Martin Blumenstingl's avatar
      ARM: dts: meson8: Fix the UART device-tree schema validation · 566b558e
      Martin Blumenstingl authored
      [ Upstream commit 57007bfb ]
      
      The dt-bindings for the UART controller only allow the following values
      for Meson8 SoCs:
      - "amlogic,meson8-uart", "amlogic,meson-ao-uart"
      - "amlogic,meson8-uart"
      
      Use the correct fallback compatible string "amlogic,meson-ao-uart" for
      AO UART. Drop the "amlogic,meson-uart" compatible string from the EE
      domain UART controllers.
      
      Also update the order of the clocks to match the order defined in the
      yaml schema.
      
      Fixes: 6ca77502
      
       ("ARM: dts: meson8: use stable UART bindings with correct gate clock")
      Signed-off-by: default avatarMartin Blumenstingl <martin.blumenstingl@googlemail.com>
      Signed-off-by: default avatarNeil Armstrong <narmstrong@baylibre.com>
      Link: https://lore.kernel.org/r/20211227180026.4068352-3-martin.blumenstingl@googlemail.com
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      566b558e
    • Martin Blumenstingl's avatar
      ARM: dts: meson: Fix the UART compatible strings · 210d70f0
      Martin Blumenstingl authored
      [ Upstream commit 5225e1b8 ]
      
      The dt-bindings for the UART controller only allow the following values
      for Meson6 SoCs:
      - "amlogic,meson6-uart", "amlogic,meson-ao-uart"
      - "amlogic,meson6-uart"
      
      Use the correct fallback compatible string "amlogic,meson-ao-uart" for
      AO UART. Drop the "amlogic,meson-uart" compatible string from the EE
      domain UART controllers.
      
      Fixes: ec9b5916
      
       ("ARM: dts: meson6: use stable UART bindings")
      Signed-off-by: default avatarMartin Blumenstingl <martin.blumenstingl@googlemail.com>
      Signed-off-by: default avatarNeil Armstrong <narmstrong@baylibre.com>
      Link: https://lore.kernel.org/r/20211227180026.4068352-2-martin.blumenstingl@googlemail.com
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      210d70f0
    • Tony Lindgren's avatar
      ARM: dts: Fix timer regression for beagleboard revision c · 88f0e613
      Tony Lindgren authored
      [ Upstream commit 23885389 ]
      
      Commit e428e250 ("ARM: dts: Configure system timers for omap3")
      caused a timer regression for beagleboard revision c where the system
      clockevent stops working if omap3isp module is unloaded.
      
      Turns out we still have beagleboard revisions a-b4 capacitor c70 quirks
      applied that limit the usable timers for no good reason. This also affects
      the power management as we use the system clock instead of the 32k clock
      source.
      
      Let's fix the issue by adding a new omap3-beagle-ab4.dts for the old timer
      quirks. This allows us to remove the timer quirks for later beagleboard
      revisions. We also need to update the related timer quirk check for the
      correct compatible property.
      
      Fixes: e428e250
      
       ("ARM: dts: Configure system timers for omap3")
      Cc: linux-kernel@vger.kernel.org
      Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Rob Herring <robh+dt@kernel.org>
      Reported-by: default avatarJarkko Nikula <jarkko.nikula@bitmer.com>
      Tested-by: default avatarJarkko Nikula <jarkko.nikula@bitmer.com>
      Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      88f0e613
    • Brian Norris's avatar
      drm/rockchip: vop: Correct RK3399 VOP register fields · c943a297
      Brian Norris authored
      commit 9da1e9ab upstream.
      
      Commit 7707f722 ("drm/rockchip: Add support for afbc") switched up
      the rk3399_vop_big[] register windows, but it did so incorrectly.
      
      The biggest problem is in rk3288_win23_data[] vs.
      rk3368_win23_data[] .format field:
      
        RK3288's format: VOP_REG(RK3288_WIN2_CTRL0, 0x7, 1)
        RK3368's format: VOP_REG(RK3368_WIN2_CTRL0, 0x3, 5)
      
      Bits 5:6 (i.e., shift 5, mask 0x3) are correct for RK3399, according to
      the TRM.
      
      There are a few other small differences between the 3288 and 3368
      definitions that were swapped in commit 7707f722. I reviewed them to
      the best of my ability according to the RK3399 TRM and fixed them up.
      
      This fixes IOMMU issues (and display errors) when testing with BG24
      color formats.
      
      Fixes: 7707f722
      
       ("drm/rockchip: Add support for afbc")
      Cc: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarBrian Norris <briannorris@chromium.org>
      Tested-by: default avatarAndrzej Pietrasiewicz <andrzej.p@collabora.com>
      Signed-off-by: default avatarHeiko Stuebner <heiko@sntech.de>
      Link: https://patchwork.freedesktop.org/patch/msgid/20220119161104.1.I1d01436bef35165a8cdfe9308789c0badb5ff46a@changeid
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c943a297
    • Rafael J. Wysocki's avatar
      PM: s2idle: ACPI: Fix wakeup interrupts handling · a941384f
      Rafael J. Wysocki authored
      commit cb1f65c1 upstream.
      
      After commit e3728b50 ("ACPI: PM: s2idle: Avoid possible race
      related to the EC GPE") wakeup interrupts occurring immediately after
      the one discarded by acpi_s2idle_wake() may be missed.  Moreover, if
      the SCI triggers again immediately after the rearming in
      acpi_s2idle_wake(), that wakeup may be missed too.
      
      The problem is that pm_system_irq_wakeup() only calls pm_system_wakeup()
      when pm_wakeup_irq is 0, but that's not the case any more after the
      interrupt causing acpi_s2idle_wake() to run until pm_wakeup_irq is
      cleared by the pm_wakeup_clear() call in s2idle_loop().  However,
      there may be wakeup interrupts occurring in that time frame and if
      that happens, they will be missed.
      
      To address that issue first move the clearing of pm_wakeup_irq to
      the point at which it is known that the interrupt causing
      acpi_s2idle_wake() to tun will be discarded, before rearming the SCI
      for wakeup.  Moreover, because that only reduces the size of the
      time window in which the issue may manifest itself, allow
      pm_system_irq_wakeup() to register two second wakeup interrupts in
      a row and, when discarding the first one, replace it with the second
      one.  [Of course, this assumes that only one wakeup interrupt can be
      discarded in one go, but currently that is the case and I am not
      aware of any plans to change that.]
      
      Fixes: e3728b50
      
       ("ACPI: PM: s2idle: Avoid possible race related to the EC GPE")
      Cc: 5.4+ <stable@vger.kernel.org> # 5.4+
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a941384f
    • Robin Murphy's avatar
      ACPI/IORT: Check node revision for PMCG resources · fcbac51a
      Robin Murphy authored
      commit da5fb9e1
      
       upstream.
      
      The original version of the IORT PMCG definition had an oversight
      wherein there was no way to describe the second register page for an
      implementation using the recommended RELOC_CTRS feature. Although the
      spec was fixed, and the final patches merged to ACPICA and Linux written
      against the new version, it seems that some old firmware based on the
      original revision has survived and turned up in the wild.
      
      Add a check for the original PMCG definition, and avoid filling in the
      second memory resource with nonsense if so. Otherwise it is likely that
      something horrible will happen when the PMCG driver attempts to probe.
      
      Reported-by: default avatarMichael Petlan <mpetlan@redhat.com>
      Fixes: 24e51604
      
       ("ACPI/IORT: Add support for PMCG")
      Cc: <stable@vger.kernel.org> # 5.2.x
      Signed-off-by: default avatarRobin Murphy <robin.murphy@arm.com>
      Acked-by: default avatarLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Link: https://lore.kernel.org/r/75628ae41c257fb73588f7bf1c4459160e04be2b.1643916258.git.robin.murphy@arm.com
      Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      fcbac51a
    • Sagi Grimberg's avatar
      nvme-tcp: fix bogus request completion when failing to send AER · 57ede0ce
      Sagi Grimberg authored
      commit 63573807
      
       upstream.
      
      AER is not backed by a real request, hence we should not incorrectly
      assume that when failing to send a nvme command, it is a normal request
      but rather check if this is an aer and if so complete the aer (similar
      to the normal completion path).
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarSagi Grimberg <sagi@grimberg.me>
      Reviewed-by: default avatarHannes Reinecke <hare@suse.de>
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      57ede0ce
    • Krzysztof Kozlowski's avatar
      ARM: socfpga: fix missing RESET_CONTROLLER · 3a669d77
      Krzysztof Kozlowski authored
      commit 3037b174 upstream.
      
      The SocFPGA machine since commit b3ca9888
      
       ("reset: socfpga: add an
      early reset driver for SoCFPGA") uses reset controller, so it should
      select RESET_CONTROLLER explicitly.  Selecting ARCH_HAS_RESET_CONTROLLER
      is not enough because it affects only default choice still allowing a
      non-buildable configuration:
      
        /usr/bin/arm-linux-gnueabi-ld: arch/arm/mach-socfpga/socfpga.o: in function `socfpga_init_irq':
        arch/arm/mach-socfpga/socfpga.c:56: undefined reference to `socfpga_reset_init'
      
      Reported-by: default avatarkernel test robot <lkp@intel.com>
      Cc: <stable@vger.kernel.org>
      Fixes: b3ca9888
      
       ("reset: socfpga: add an early reset driver for SoCFPGA")
      Signed-off-by: default avatarKrzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
      Signed-off-by: default avatarDinh Nguyen <dinguyen@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3a669d77
    • Linus Walleij's avatar
      ARM: dts: Fix boot regression on Skomer · 435e62d5
      Linus Walleij authored
      commit d9058d6a
      
       upstream.
      
      The signal routing on the Skomer board was incorrect making
      it impossible to mount root from the SD card. Fix this up.
      
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Cc: stable@vger.kernel.org
      Cc: Stefan Hansson <newbyte@disroot.org>
      Link: https://lore.kernel.org/r/20220205235312.446730-1-linus.walleij@linaro.org'
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      435e62d5
    • Fabio Estevam's avatar
      ARM: dts: imx23-evk: Remove MX23_PAD_SSP1_DETECT from hog group · b217b89e
      Fabio Estevam authored
      commit 42c9b28e upstream.
      
      Currently, SD card fails to mount due to the following pinctrl error:
      
      [   11.170000] imx23-pinctrl 80018000.pinctrl: pin SSP1_DETECT already requested by 80018000.pinctrl; cannot claim for 80010000.spi
      [   11.180000] imx23-pinctrl 80018000.pinctrl: pin-65 (80010000.spi) status -22
      [   11.190000] imx23-pinctrl 80018000.pinctrl: could not request pin 65 (SSP1_DETECT) from group mmc0-pins-fixup.0  on device 80018000.pinctrl
      [   11.200000] mxs-mmc 80010000.spi: Error applying setting, reverse things back
      
      Fix it by removing the MX23_PAD_SSP1_DETECT pin from the hog group as it
      is already been used by the mmc0-pins-fixup pinctrl group.
      
      With this change the rootfs can be mounted and the imx23-evk board can
      boot successfully.
      
      Cc: <stable@vger.kernel.org>
      Fixes: bc3875f1
      
       ("ARM: dts: mxs: modify mx23/mx28 dts files to use pinctrl headers")
      Signed-off-by: default avatarFabio Estevam <festevam@gmail.com>
      Signed-off-by: default avatarShawn Guo <shawnguo@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b217b89e
    • Aurelien Jarno's avatar
      riscv: fix build with binutils 2.38 · 3f9843f2
      Aurelien Jarno authored
      commit 6df2a016
      
       upstream.
      
      From version 2.38, binutils default to ISA spec version 20191213. This
      means that the csr read/write (csrr*/csrw*) instructions and fence.i
      instruction has separated from the `I` extension, become two standalone
      extensions: Zicsr and Zifencei. As the kernel uses those instruction,
      this causes the following build failure:
      
        CC      arch/riscv/kernel/vdso/vgettimeofday.o
        <<BUILDDIR>>/arch/riscv/include/asm/vdso/gettimeofday.h: Assembler messages:
        <<BUILDDIR>>/arch/riscv/include/asm/vdso/gettimeofday.h:71: Error: unrecognized opcode `csrr a5,0xc01'
        <<BUILDDIR>>/arch/riscv/include/asm/vdso/gettimeofday.h:71: Error: unrecognized opcode `csrr a5,0xc01'
        <<BUILDDIR>>/arch/riscv/include/asm/vdso/gettimeofday.h:71: Error: unrecognized opcode `csrr a5,0xc01'
        <<BUILDDIR>>/arch/riscv/include/asm/vdso/gettimeofday.h:71: Error: unrecognized opcode `csrr a5,0xc01'
      
      The fix is to specify those extensions explicitely in -march. However as
      older binutils version do not support this, we first need to detect
      that.
      
      Signed-off-by: default avatarAurelien Jarno <aurelien@aurel32.net>
      Tested-by: default avatarAlexandre Ghiti <alexandre.ghiti@canonical.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3f9843f2
    • Sean Christopherson's avatar
      KVM: VMX: Set vmcs.PENDING_DBG.BS on #DB in STI/MOVSS blocking shadow · 3aa5c865
      Sean Christopherson authored
      [ Upstream commit b9bed78e
      
       ]
      
      Set vmcs.GUEST_PENDING_DBG_EXCEPTIONS.BS, a.k.a. the pending single-step
      breakpoint flag, when re-injecting a #DB with RFLAGS.TF=1, and STI or
      MOVSS blocking is active.  Setting the flag is necessary to make VM-Entry
      consistency checks happy, as VMX has an invariant that if RFLAGS.TF is
      set and STI/MOVSS blocking is true, then the previous instruction must
      have been STI or MOV/POP, and therefore a single-step #DB must be pending
      since the RFLAGS.TF cannot have been set by the previous instruction,
      i.e. the one instruction delay after setting RFLAGS.TF must have already
      expired.
      
      Normally, the CPU sets vmcs.GUEST_PENDING_DBG_EXCEPTIONS.BS appropriately
      when recording guest state as part of a VM-Exit, but #DB VM-Exits
      intentionally do not treat the #DB as "guest state" as interception of
      the #DB effectively makes the #DB host-owned, thus KVM needs to manually
      set PENDING_DBG.BS when forwarding/re-injecting the #DB to the guest.
      
      Note, although this bug can be triggered by guest userspace, doing so
      requires IOPL=3, and guest userspace running with IOPL=3 has full access
      to all I/O ports (from the guest's perspective) and can crash/reboot the
      guest any number of ways.  IOPL=3 is required because STI blocking kicks
      in if and only if RFLAGS.IF is toggled 0=>1, and if CPL>IOPL, STI either
      takes a #GP or modifies RFLAGS.VIF, not RFLAGS.IF.
      
      MOVSS blocking can be initiated by userspace, but can be coincident with
      a #DB if and only if DR7.GD=1 (General Detect enabled) and a MOV DR is
      executed in the MOVSS shadow.  MOV DR #GPs at CPL>0, thus MOVSS blocking
      is problematic only for CPL0 (and only if the guest is crazy enough to
      access a DR in a MOVSS shadow).  All other sources of #DBs are either
      suppressed by MOVSS blocking (single-step, code fetch, data, and I/O),
      are mutually exclusive with MOVSS blocking (T-bit task switch), or are
      already handled by KVM (ICEBP, a.k.a. INT1).
      
      This bug was originally found by running tests[1] created for XSA-308[2].
      Note that Xen's userspace test emits ICEBP in the MOVSS shadow, which is
      presumably why the Xen bug was deemed to be an exploitable DOS from guest
      userspace.  KVM already handles ICEBP by skipping the ICEBP instruction
      and thus clears MOVSS blocking as a side effect of its "emulation".
      
      [1] http://xenbits.xenproject.org/docs/xtf/xsa-308_2main_8c_source.html
      [2] https://xenbits.xen.org/xsa/advisory-308.html
      
      Reported-by: default avatarDavid Woodhouse <dwmw2@infradead.org>
      Reported-by: default avatarAlexander Graf <graf@amazon.de>
      Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
      Message-Id: <20220120000624.655815-1-seanjc@google.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      3aa5c865
    • Sean Christopherson's avatar
      KVM: SVM: Don't kill SEV guest if SMAP erratum triggers in usermode · bd39fe29
      Sean Christopherson authored
      [ Upstream commit cdf85e0c
      
       ]
      
      Inject a #GP instead of synthesizing triple fault to try to avoid killing
      the guest if emulation of an SEV guest fails due to encountering the SMAP
      erratum.  The injected #GP may still be fatal to the guest, e.g. if the
      userspace process is providing critical functionality, but KVM should
      make every attempt to keep the guest alive.
      
      Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
      Reviewed-by: default avatarLiam Merwick <liam.merwick@oracle.com>
      Message-Id: <20220120010719.711476-10-seanjc@google.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      bd39fe29
    • Vitaly Kuznetsov's avatar
      KVM: nVMX: Also filter MSR_IA32_VMX_TRUE_PINBASED_CTLS when eVMCS · 9efad4cb
      Vitaly Kuznetsov authored
      [ Upstream commit f80ae0ef
      
       ]
      
      Similar to MSR_IA32_VMX_EXIT_CTLS/MSR_IA32_VMX_TRUE_EXIT_CTLS,
      MSR_IA32_VMX_ENTRY_CTLS/MSR_IA32_VMX_TRUE_ENTRY_CTLS pair,
      MSR_IA32_VMX_TRUE_PINBASED_CTLS needs to be filtered the same way
      MSR_IA32_VMX_PINBASED_CTLS is currently filtered as guests may solely rely
      on 'true' MSR data.
      
      Note, none of the currently existing Windows/Hyper-V versions are known
      to stumble upon the unfiltered MSR_IA32_VMX_TRUE_PINBASED_CTLS, the change
      is aimed at making the filtering future proof.
      
      Signed-off-by: default avatarVitaly Kuznetsov <vkuznets@redhat.com>
      Message-Id: <20220112170134.1904308-2-vkuznets@redhat.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      9efad4cb
    • Vitaly Kuznetsov's avatar
      KVM: nVMX: eVMCS: Filter out VM_EXIT_SAVE_VMX_PREEMPTION_TIMER · db58a3d9
      Vitaly Kuznetsov authored
      [ Upstream commit 7a601e2c
      
       ]
      
      Enlightened VMCS v1 doesn't have VMX_PREEMPTION_TIMER_VALUE field,
      PIN_BASED_VMX_PREEMPTION_TIMER is also filtered out already so it makes
      sense to filter out VM_EXIT_SAVE_VMX_PREEMPTION_TIMER too.
      
      Note, none of the currently existing Windows/Hyper-V versions are known
      to enable 'save VMX-preemption timer value' when eVMCS is in use, the
      change is aimed at making the filtering future proof.
      
      Signed-off-by: default avatarVitaly Kuznetsov <vkuznets@redhat.com>
      Message-Id: <20220112170134.1904308-3-vkuznets@redhat.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      db58a3d9
    • Hou Wenlong's avatar
      KVM: eventfd: Fix false positive RCU usage warning · dc129275
      Hou Wenlong authored
      [ Upstream commit 6a0c6170
      
       ]
      
      Fix the following false positive warning:
       =============================
       WARNING: suspicious RCU usage
       5.16.0-rc4+ #57 Not tainted
       -----------------------------
       arch/x86/kvm/../../../virt/kvm/eventfd.c:484 RCU-list traversed in non-reader section!!
      
       other info that might help us debug this:
      
       rcu_scheduler_active = 2, debug_locks = 1
       3 locks held by fc_vcpu 0/330:
        #0: ffff8884835fc0b0 (&vcpu->mutex){+.+.}-{3:3}, at: kvm_vcpu_ioctl+0x88/0x6f0 [kvm]
        #1: ffffc90004c0bb68 (&kvm->srcu){....}-{0:0}, at: vcpu_enter_guest+0x600/0x1860 [kvm]
        #2: ffffc90004c0c1d0 (&kvm->irq_srcu){....}-{0:0}, at: kvm_notify_acked_irq+0x36/0x180 [kvm]
      
       stack backtrace:
       CPU: 26 PID: 330 Comm: fc_vcpu 0 Not tainted 5.16.0-rc4+
       Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.14.0-0-g155821a1990b-prebuilt.qemu.org 04/01/2014
       Call Trace:
        <TASK>
        dump_stack_lvl+0x44/0x57
        kvm_notify_acked_gsi+0x6b/0x70 [kvm]
        kvm_notify_acked_irq+0x8d/0x180 [kvm]
        kvm_ioapic_update_eoi+0x92/0x240 [kvm]
        kvm_apic_set_eoi_accelerated+0x2a/0xe0 [kvm]
        handle_apic_eoi_induced+0x3d/0x60 [kvm_intel]
        vmx_handle_exit+0x19c/0x6a0 [kvm_intel]
        vcpu_enter_guest+0x66e/0x1860 [kvm]
        kvm_arch_vcpu_ioctl_run+0x438/0x7f0 [kvm]
        kvm_vcpu_ioctl+0x38a/0x6f0 [kvm]
        __x64_sys_ioctl+0x89/0xc0
        do_syscall_64+0x3a/0x90
        entry_SYSCALL_64_after_hwframe+0x44/0xae
      
      Since kvm_unregister_irq_ack_notifier() does synchronize_srcu(&kvm->irq_srcu),
      kvm->irq_ack_notifier_list is protected by kvm->irq_srcu. In fact,
      kvm->irq_srcu SRCU read lock is held in kvm_notify_acked_irq(), making it
      a false positive warning. So use hlist_for_each_entry_srcu() instead of
      hlist_for_each_entry_rcu().
      
      Reviewed-by: default avatarSean Christopherson <seanjc@google.com>
      Signed-off-by: default avatarHou Wenlong <houwenlong93@linux.alibaba.com>
      Message-Id: <f98bac4f5052bad2c26df9ad50f7019e40434512.1643265976.git.houwenlong.hwl@antgroup.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      dc129275
    • Jisheng Zhang's avatar
      net: stmmac: dwmac-sun8i: use return val of readl_poll_timeout() · 87bbd78a
      Jisheng Zhang authored
      [ Upstream commit 9e0db41e
      
       ]
      
      When readl_poll_timeout() timeout, we'd better directly use its return
      value.
      
      Before this patch:
      [    2.145528] dwmac-sun8i: probe of 4500000.ethernet failed with error -14
      
      After this patch:
      [    2.138520] dwmac-sun8i: probe of 4500000.ethernet failed with error -110
      
      Signed-off-by: default avatarJisheng Zhang <jszhang@kernel.org>
      Acked-by: default avatarJernej Skrabec <jernej.skrabec@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      87bbd78a