Skip to content
  1. Feb 09, 2022
    • 蒋家盛's avatar
      ASoC: cpcap: Check for NULL pointer after calling of_get_child_by_name · 02f45971
      蒋家盛 authored
      commit f7a6021a upstream.
      
      If the device does not exist, of_get_child_by_name() will return NULL
      pointer.
      And devm_snd_soc_register_component() does not check it.
      Also, I have noticed that cpcap_codec_driver has not been used yet.
      Therefore, it should be better to check it in order to avoid the future
      dereference of the NULL pointer.
      
      Fixes: f6cdf2d3
      
       ("ASoC: cpcap: new codec")
      Signed-off-by: default avatarJiasheng Jiang <jiasheng@iscas.ac.cn>
      Link: https://lore.kernel.org/r/20220111025048.524134-1-jiasheng@iscas.ac.cn
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      02f45971
    • Robert Hancock's avatar
      ASoC: xilinx: xlnx_formatter_pcm: Make buffer bytes multiple of period bytes · cb5f1fbd
      Robert Hancock authored
      commit e958b588 upstream.
      
      This patch is based on one in the Xilinx kernel tree, "ASoc: xlnx: Make
      buffer bytes multiple of period bytes" by Devarsh Thakkar. The same
      issue exists in the mainline version of the driver. The original
      patch description is as follows:
      
      "The Xilinx Audio Formatter IP has a constraint on period
      bytes to be multiple of 64. This leads to driver changing
      the period size to suitable frames such that period bytes
      are multiple of 64.
      
      Now since period bytes and period size are updated but not
      the buffer bytes, this may make the buffer bytes unaligned
      and not multiple of period bytes.
      
      When this happens we hear popping noise as while DMA is being
      done the buffer bytes are not enough to complete DMA access
      for last period of frame within the application buffer boundary.
      
      To avoid this, align buffer bytes too as multiple of 64, and
      set another constraint to always enforce number of periods as
      integer. Now since, there is already a rule in alsa core
      to enforce Buffer size = Number of Periods * Period Size
      this automatically aligns buffer bytes as multiple of period
      bytes."
      
      Fixes: 6f6c3c36
      
       ("ASoC: xlnx: add pcm formatter platform driver")
      Cc: Devarsh Thakkar <devarsh.thakkar@xilinx.com>
      Signed-off-by: default avatarRobert Hancock <robert.hancock@calian.com>
      Link: https://lore.kernel.org/r/20220107214711.1100162-2-robert.hancock@calian.com
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      cb5f1fbd
    • Miaoqian Lin's avatar
      ASoC: fsl: Add missing error handling in pcm030_fabric_probe · 56e0747d
      Miaoqian Lin authored
      commit fb25621d upstream.
      
      Add the missing platform_device_put() and platform_device_del()
      before return from pcm030_fabric_probe in the error handling case.
      
      Fixes: c912fa91
      
       ("ASoC: fsl: register the wm9712-codec")
      Signed-off-by: default avatarMiaoqian Lin <linmq006@gmail.com>
      Link: https://lore.kernel.org/r/20220127131336.30214-1-linmq006@gmail.com
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      56e0747d
    • Dan Carpenter's avatar
      drm/i915/overlay: Prevent divide by zero bugs in scaling · 3e698375
      Dan Carpenter authored
      commit 90a3d22f upstream.
      
      Smatch detected a divide by zero bug in check_overlay_scaling().
      
          drivers/gpu/drm/i915/display/intel_overlay.c:976 check_overlay_scaling()
          error: potential divide by zero bug '/ rec->dst_height'.
          drivers/gpu/drm/i915/display/intel_overlay.c:980 check_overlay_scaling()
          error: potential divide by zero bug '/ rec->dst_width'.
      
      Prevent this by ensuring that the dst height and width are non-zero.
      
      Fixes: 02e792fb
      
       ("drm/i915: implement drmmode overlay support v4")
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20220124122409.GA31673@kili
      (cherry picked from commit cf5b64f7
      
      )
      Signed-off-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3e698375
    • Yannick Vignon's avatar
      net: stmmac: ensure PTP time register reads are consistent · 9ea01853
      Yannick Vignon authored
      commit 80d46090 upstream.
      
      Even if protected from preemption and interrupts, a small time window
      remains when the 2 register reads could return inconsistent values,
      each time the "seconds" register changes. This could lead to an about
      1-second error in the reported time.
      
      Add logic to ensure the "seconds" and "nanoseconds" values are consistent.
      
      Fixes: 92ba6888
      
       ("stmmac: add the support for PTP hw clock driver")
      Signed-off-by: default avatarYannick Vignon <yannick.vignon@nxp.com>
      Reviewed-by: default avatarRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
      Link: https://lore.kernel.org/r/20220203160025.750632-1-yannick.vignon@oss.nxp.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9ea01853
    • Camel Guo's avatar
      net: stmmac: dump gmac4 DMA registers correctly · 41df2da2
      Camel Guo authored
      commit 7af037c3 upstream.
      
      Unlike gmac100, gmac1000, gmac4 has 27 DMA registers and they are
      located at DMA_CHAN_BASE_ADDR (0x1100). In order for ethtool to dump
      gmac4 DMA registers correctly, this commit checks if a net_device has
      gmac4 and uses different logic to dump its DMA registers.
      
      This fixes the following KASAN warning, which can normally be triggered
      by a command similar like "ethtool -d eth0":
      
      BUG: KASAN: vmalloc-out-of-bounds in dwmac4_dump_dma_regs+0x6d4/0xb30
      Write of size 4 at addr ffffffc010177100 by task ethtool/1839
       kasan_report+0x200/0x21c
       __asan_report_store4_noabort+0x34/0x60
       dwmac4_dump_dma_regs+0x6d4/0xb30
       stmmac_ethtool_gregs+0x110/0x204
       ethtool_get_regs+0x200/0x4b0
       dev_ethtool+0x1dac/0x3800
       dev_ioctl+0x7c0/0xb50
       sock_ioctl+0x298/0x6c4
       ...
      
      Fixes: fbf68229
      
       ("net: stmmac: unify registers dumps methods")
      Signed-off-by: default avatarCamel Guo <camelg@axis.com>
      Link: https://lore.kernel.org/r/20220131083841.3346801-1-camel.guo@axis.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      41df2da2
    • Lior Nahmanson's avatar
      net: macsec: Verify that send_sci is on when setting Tx sci explicitly · 114bf935
      Lior Nahmanson authored
      commit d0cfa548 upstream.
      
      When setting Tx sci explicit, the Rx side is expected to use this
      sci and not recalculate it from the packet.However, in case of Tx sci
      is explicit and send_sci is off, the receiver is wrongly recalculate
      the sci from the source MAC address which most likely be different
      than the explicit sci.
      
      Fix by preventing such configuration when macsec newlink is established
      and return EINVAL error code on such cases.
      
      Fixes: c09440f7
      
       ("macsec: introduce IEEE 802.1AE driver")
      Signed-off-by: default avatarLior Nahmanson <liorna@nvidia.com>
      Reviewed-by: default avatarRaed Salem <raeds@nvidia.com>
      Signed-off-by: default avatarRaed Salem <raeds@nvidia.com>
      Link: https://lore.kernel.org/r/1643542672-29403-1-git-send-email-raeds@nvidia.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      114bf935
    • Lior Nahmanson's avatar
      net: macsec: Fix offload support for NETDEV_UNREGISTER event · 2e7f5b6e
      Lior Nahmanson authored
      commit 9cef24c8 upstream.
      
      Current macsec netdev notify handler handles NETDEV_UNREGISTER event by
      releasing relevant SW resources only, this causes resources leak in case
      of macsec HW offload, as the underlay driver was not notified to clean
      it's macsec offload resources.
      
      Fix by calling the underlay driver to clean it's relevant resources
      by moving offload handling from macsec_dellink() to macsec_common_dellink()
      when handling NETDEV_UNREGISTER event.
      
      Fixes: 3cf3227a
      
       ("net: macsec: hardware offloading infrastructure")
      Signed-off-by: default avatarLior Nahmanson <liorna@nvidia.com>
      Reviewed-by: default avatarRaed Salem <raeds@nvidia.com>
      Signed-off-by: default avatarRaed Salem <raeds@nvidia.com>
      Reviewed-by: default avatarAntoine Tenart <atenart@kernel.org>
      Link: https://lore.kernel.org/r/1643542141-28956-1-git-send-email-raeds@nvidia.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2e7f5b6e
    • Miquel Raynal's avatar
      net: ieee802154: Return meaningful error codes from the netlink helpers · 87b1c9fa
      Miquel Raynal authored
      commit 79c37ca7 upstream.
      
      Returning -1 does not indicate anything useful.
      
      Use a standard and meaningful error code instead.
      
      Fixes: a26c5fd7
      
       ("nl802154: add support for security layer")
      Signed-off-by: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
      Acked-by: default avatarAlexander Aring <aahringo@redhat.com>
      Link: https://lore.kernel.org/r/20220125121426.848337-6-miquel.raynal@bootlin.com
      Signed-off-by: default avatarStefan Schmidt <stefan@datenfreihafen.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      87b1c9fa
    • Miquel Raynal's avatar
      net: ieee802154: ca8210: Stop leaking skb's · 78b3f20c
      Miquel Raynal authored
      commit 621b24b0 upstream.
      
      Upon error the ieee802154_xmit_complete() helper is not called. Only
      ieee802154_wake_queue() is called manually. We then leak the skb
      structure.
      
      Free the skb structure upon error before returning.
      
      Fixes: ded845a7
      
       ("ieee802154: Add CA8210 IEEE 802.15.4 device driver")
      Signed-off-by: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
      Acked-by: default avatarAlexander Aring <aahringo@redhat.com>
      Link: https://lore.kernel.org/r/20220125121426.848337-5-miquel.raynal@bootlin.com
      Signed-off-by: default avatarStefan Schmidt <stefan@datenfreihafen.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      78b3f20c
    • Miquel Raynal's avatar
      net: ieee802154: mcr20a: Fix lifs/sifs periods · 0bfe50dc
      Miquel Raynal authored
      commit d753c400 upstream.
      
      These periods are expressed in time units (microseconds) while 40 and 12
      are the number of symbol durations these periods will last. We need to
      multiply them both with phy->symbol_duration in order to get these
      values in microseconds.
      
      Fixes: 8c6ad9cc
      
       ("ieee802154: Add NXP MCR20A IEEE 802.15.4 transceiver driver")
      Signed-off-by: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
      Acked-by: default avatarAlexander Aring <aahringo@redhat.com>
      Link: https://lore.kernel.org/r/20220125121426.848337-3-miquel.raynal@bootlin.com
      Signed-off-by: default avatarStefan Schmidt <stefan@datenfreihafen.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0bfe50dc
    • Miquel Raynal's avatar
      net: ieee802154: hwsim: Ensure proper channel selection at probe time · 75bbda31
      Miquel Raynal authored
      commit 1293fccc upstream.
      
      Drivers are expected to set the PHY current_channel and current_page
      according to their default state. The hwsim driver is advertising being
      configured on channel 13 by default but that is not reflected in its own
      internal pib structure. In order to ensure that this driver consider the
      current channel as being 13 internally, we at least need to set the
      pib->channel field to 13.
      
      Fixes: f25da51f
      
       ("ieee802154: hwsim: add replacement for fakelb")
      Signed-off-by: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
      [stefan@datenfreihafen.org: fixed assigment from page to channel]
      Acked-by: default avatarAlexander Aring <aahringo@redhat.com>
      Link: https://lore.kernel.org/r/20220125121426.848337-2-miquel.raynal@bootlin.com
      Signed-off-by: default avatarStefan Schmidt <stefan@datenfreihafen.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      75bbda31
    • Xin Xiong's avatar
      spi: uniphier: fix reference count leak in uniphier_spi_probe() · e895e067
      Xin Xiong authored
      commit 37c2c83c
      
       upstream.
      
      The issue happens in several error paths in uniphier_spi_probe().
      When either dma_get_slave_caps() or devm_spi_register_master() returns
      an error code, the function forgets to decrease the refcount of both
      `dma_rx` and `dma_tx` objects, which may lead to refcount leaks.
      
      Fix it by decrementing the reference count of specific objects in
      those error paths.
      
      Signed-off-by: default avatarXin Xiong <xiongx18@fudan.edu.cn>
      Signed-off-by: default avatarXiyu Yang <xiyuyang19@fudan.edu.cn>
      Signed-off-by: default avatarXin Tan <tanxin.ctf@gmail.com>
      Reviewed-by: default avatarKunihiko Hayashi <hayashi.kunihiko@socionext.com>
      Fixes: 28d1dddc
      
       ("spi: uniphier: Add DMA transfer mode support")
      Link: https://lore.kernel.org/r/20220125101214.35677-1-xiongx18@fudan.edu.cn
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e895e067
    • Miaoqian Lin's avatar
      spi: meson-spicc: add IRQ check in meson_spicc_probe · ec942d08
      Miaoqian Lin authored
      commit e937440f upstream.
      
      This check misses checking for  platform_get_irq()'s call and may passes
      the negative error codes to devm_request_irq(), which takes unsigned IRQ #,
      causing it to fail with -EINVAL, overriding an original error code.
      Stop calling devm_request_irq() with invalid IRQ #s.
      
      Fixes: 454fa271
      
       ("spi: Add Meson SPICC driver")
      Signed-off-by: default avatarMiaoqian Lin <linmq006@gmail.com>
      Link: https://lore.kernel.org/r/20220126110447.24549-1-linmq006@gmail.com
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ec942d08
    • Benjamin Gaignard's avatar
      spi: mediatek: Avoid NULL pointer crash in interrupt · c2cf65e1
      Benjamin Gaignard authored
      commit f83a96e5 upstream.
      
      In some case, like after a transfer timeout, master->cur_msg pointer
      is NULL which led to a kernel crash when trying to use master->cur_msg->spi.
      mtk_spi_can_dma(), pointed by master->can_dma, doesn't use this parameter
      avoid the problem by setting NULL as second parameter.
      
      Fixes: a568231f
      
       ("spi: mediatek: Add spi bus for Mediatek MT8173")
      Signed-off-by: default avatarBenjamin Gaignard <benjamin.gaignard@collabora.com>
      Link: https://lore.kernel.org/r/20220131141708.888710-1-benjamin.gaignard@collabora.com
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c2cf65e1
    • Kamal Dasu's avatar
      spi: bcm-qspi: check for valid cs before applying chip select · 30e05c98
      Kamal Dasu authored
      commit 2cbd2726 upstream.
      
      Apply only valid chip select value. This change fixes case where chip
      select is set to initial value of '-1' during probe and  PM supend and
      subsequent resume can try to use the value with undefined behaviour.
      Also in case where gpio based chip select, the check in
      bcm_qspi_chip_select() shall prevent undefined behaviour on resume.
      
      Fixes: fa236a7e
      
       ("spi: bcm-qspi: Add Broadcom MSPI driver")
      Signed-off-by: default avatarKamal Dasu <kdasu.kdev@gmail.com>
      Acked-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Link: https://lore.kernel.org/r/20220127185359.27322-1-kdasu.kdev@gmail.com
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      30e05c98
    • Joerg Roedel's avatar
      iommu/amd: Fix loop timeout issue in iommu_ga_log_enable() · 6d226e8a
      Joerg Roedel authored
      commit 9b45a773 upstream.
      
      The polling loop for the register change in iommu_ga_log_enable() needs
      to have a udelay() in it.  Otherwise the CPU might be faster than the
      IOMMU hardware and wrongly trigger the WARN_ON() further down the code
      stream. Use a 10us for udelay(), has there is some hardware where
      activation of the GA log can take more than a 100ms.
      
      A future optimization should move the activation check of the GA log
      to the point where it gets used for the first time. But that is a
      bigger change and not suitable for a fix.
      
      Fixes: 8bda0cfb
      
       ("iommu/amd: Detect and initialize guest vAPIC log")
      Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
      Link: https://lore.kernel.org/r/20220204115537.3894-1-joro@8bytes.org
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6d226e8a
    • Guoqing Jiang's avatar
      iommu/vt-d: Fix potential memory leak in intel_setup_irq_remapping() · 9d9995b0
      Guoqing Jiang authored
      commit 99e675d4 upstream.
      
      After commit e3beca48 ("irqdomain/treewide: Keep firmware node
      unconditionally allocated"). For tear down scenario, fn is only freed
      after fail to allocate ir_domain, though it also should be freed in case
      dmar_enable_qi returns error.
      
      Besides free fn, irq_domain and ir_msi_domain need to be removed as well
      if intel_setup_irq_remapping fails to enable queued invalidation.
      
      Improve the rewinding path by add out_free_ir_domain and out_free_fwnode
      lables per Baolu's suggestion.
      
      Fixes: e3beca48
      
       ("irqdomain/treewide: Keep firmware node unconditionally allocated")
      Suggested-by: default avatarLu Baolu <baolu.lu@linux.intel.com>
      Signed-off-by: default avatarGuoqing Jiang <guoqing.jiang@linux.dev>
      Link: https://lore.kernel.org/r/20220119063640.16864-1-guoqing.jiang@linux.dev
      Signed-off-by: default avatarLu Baolu <baolu.lu@linux.intel.com>
      Link: https://lore.kernel.org/r/20220128031002.2219155-3-baolu.lu@linux.intel.com
      Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9d9995b0
    • Leon Romanovsky's avatar
      RDMA/mlx4: Don't continue event handler after memory allocation failure · b3958d31
      Leon Romanovsky authored
      commit f3136c4c upstream.
      
      The failure to allocate memory during MLX4_DEV_EVENT_PORT_MGMT_CHANGE
      event handler will cause skip the assignment logic, but
      ib_dispatch_event() will be called anyway.
      
      Fix it by calling to return instead of break after memory allocation
      failure.
      
      Fixes: 00f5ce99
      
       ("mlx4: Use port management change event instead of smp_snoop")
      Link: https://lore.kernel.org/r/12a0e83f18cfad4b5f62654f141e240d04915e10.1643622264.git.leonro@nvidia.com
      Signed-off-by: default avatarLeon Romanovsky <leonro@nvidia.com>
      Reviewed-by: default avatarHåkon Bugge <haakon.bugge@oracle.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b3958d31
    • Bernard Metzler's avatar
      RDMA/siw: Fix broken RDMA Read Fence/Resume logic. · d3f8b927
      Bernard Metzler authored
      commit b43a76f4 upstream.
      
      Code unconditionally resumed fenced SQ processing after next RDMA Read
      completion, even if other RDMA Read responses are still outstanding, or
      ORQ is full. Also adds comments for better readability of fence
      processing, and removes orq_get_tail() helper, which is not needed
      anymore.
      
      Fixes: 8b6a361b ("rdma/siw: receive path")
      Fixes: a5319752
      
       ("rdma/siw: main include file")
      Link: https://lore.kernel.org/r/20220130170815.1940-1-bmt@zurich.ibm.com
      Reported-by: default avatarJared Holzman <jared.holzman@excelero.com>
      Signed-off-by: default avatarBernard Metzler <bmt@zurich.ibm.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d3f8b927
    • Mike Marciniszyn's avatar
      IB/rdmavt: Validate remote_addr during loopback atomic tests · c7db20f5
      Mike Marciniszyn authored
      commit 4028bccb upstream.
      
      The rdma-core test suite sends an unaligned remote address and expects a
      failure.
      
      ERROR: test_atomic_non_aligned_addr (tests.test_atomic.AtomicTest)
      
      The qib/hfi1 rc handling validates properly, but the test has the client
      and server on the same system.
      
      The loopback of these operations is a distinct code path.
      
      Fix by syntaxing the proposed remote address in the loopback code path.
      
      Fixes: 15703461
      
       ("IB/{hfi1, qib, rdmavt}: Move ruc_loopback to rdmavt")
      Link: https://lore.kernel.org/r/1642584489-141005-1-git-send-email-mike.marciniszyn@cornelisnetworks.com
      Reviewed-by: default avatarDennis Dalessandro <dennis.dalessandro@cornelisnetworks.com>
      Signed-off-by: default avatarMike Marciniszyn <mike.marciniszyn@cornelisnetworks.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c7db20f5
    • Leon Romanovsky's avatar
      RDMA/ucma: Protect mc during concurrent multicast leaves · 75c61021
      Leon Romanovsky authored
      commit 36e8169e upstream.
      
      Partially revert the commit mentioned in the Fixes line to make sure that
      allocation and erasing multicast struct are locked.
      
        BUG: KASAN: use-after-free in ucma_cleanup_multicast drivers/infiniband/core/ucma.c:491 [inline]
        BUG: KASAN: use-after-free in ucma_destroy_private_ctx+0x914/0xb70 drivers/infiniband/core/ucma.c:579
        Read of size 8 at addr ffff88801bb74b00 by task syz-executor.1/25529
        CPU: 0 PID: 25529 Comm: syz-executor.1 Not tainted 5.16.0-rc7-syzkaller #0
        Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
        Call Trace:
         __dump_stack lib/dump_stack.c:88 [inline]
         dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106
         print_address_description.constprop.0.cold+0x8d/0x320 mm/kasan/report.c:247
         __kasan_report mm/kasan/report.c:433 [inline]
         kasan_report.cold+0x83/0xdf mm/kasan/report.c:450
         ucma_cleanup_multicast drivers/infiniband/core/ucma.c:491 [inline]
         ucma_destroy_private_ctx+0x914/0xb70 drivers/infiniband/core/ucma.c:579
         ucma_destroy_id+0x1e6/0x280 drivers/infiniband/core/ucma.c:614
         ucma_write+0x25c/0x350 drivers/infiniband/core/ucma.c:1732
         vfs_write+0x28e/0xae0 fs/read_write.c:588
         ksys_write+0x1ee/0x250 fs/read_write.c:643
         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
      
      Currently the xarray search can touch a concurrently freeing mc as the
      xa_for_each() is not surrounded by any lock. Rather than hold the lock for
      a full scan hold it only for the effected items, which is usually an empty
      list.
      
      Fixes: 95fe5109
      
       ("RDMA/ucma: Remove mc_list and rely on xarray")
      Link: https://lore.kernel.org/r/1cda5fabb1081e8d16e39a48d3a4f8160cea88b8.1642491047.git.leonro@nvidia.com
      Reported-by: default avatar <syzbot+e3f96c43d19782dd14a7@syzkaller.appspotmail.com>
      Suggested-by: default avatarJason Gunthorpe <jgg@nvidia.com>
      Reviewed-by: default avatarMaor Gottlieb <maorg@nvidia.com>
      Signed-off-by: default avatarLeon Romanovsky <leonro@nvidia.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      75c61021
    • Maor Gottlieb's avatar
      RDMA/cma: Use correct address when leaving multicast group · 37197906
      Maor Gottlieb authored
      commit d9e410eb upstream.
      
      In RoCE we should use cma_iboe_set_mgid() and not cma_set_mgid to generate
      the mgid, otherwise we will generate an IGMP for an incorrect address.
      
      Fixes: b5de0c60
      
       ("RDMA/cma: Fix use after free race in roce multicast join")
      Link: https://lore.kernel.org/r/913bc6783fd7a95fe71ad9454e01653ee6fb4a9a.1642491047.git.leonro@nvidia.com
      Signed-off-by: default avatarMaor Gottlieb <maorg@nvidia.com>
      Signed-off-by: default avatarLeon Romanovsky <leonro@nvidia.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      37197906
    • Yutian Yang's avatar
      memcg: charge fs_context and legacy_fs_context · aa4ecd99
      Yutian Yang authored
      commit bb902cb4
      
       upstream.
      
      This patch adds accounting flags to fs_context and legacy_fs_context
      allocation sites so that kernel could correctly charge these objects.
      
      We have written a PoC to demonstrate the effect of the missing-charging
      bugs.  The PoC takes around 1,200MB unaccounted memory, while it is
      charged for only 362MB memory usage.  We evaluate the PoC on QEMU x86_64
      v5.2.90 + Linux kernel v5.10.19 + Debian buster.  All the limitations
      including ulimits and sysctl variables are set as default.  Specifically,
      the hard NOFILE limit and nr_open in sysctl are both 1,048,576.
      
      /*------------------------- POC code ----------------------------*/
      
      #define _GNU_SOURCE
      #include <sys/types.h>
      #include <sys/file.h>
      #include <time.h>
      #include <sys/wait.h>
      #include <stdint.h>
      #include <stdlib.h>
      #include <unistd.h>
      #include <stdio.h>
      #include <signal.h>
      #include <sched.h>
      #include <fcntl.h>
      #include <linux/mount.h>
      
      #define errExit(msg)    do { perror(msg); exit(EXIT_FAILURE); \
                              } while (0)
      
      #define STACK_SIZE (8 * 1024)
      #ifndef __NR_fsopen
      #define __NR_fsopen 430
      #endif
      static inline int fsopen(const char *fs_name, unsigned int flags)
      {
              return syscall(__NR_fsopen, fs_name, flags);
      }
      
      static char thread_stack[512][STACK_SIZE];
      
      int thread_fn(void* arg)
      {
        for (int i = 0; i< 800000; ++i) {
          int fsfd = fsopen("nfs", FSOPEN_CLOEXEC);
          if (fsfd == -1) {
            errExit("fsopen");
          }
        }
        while(1);
        return 0;
      }
      
      int main(int argc, char *argv[]) {
        int thread_pid;
        for (int i = 0; i < 1; ++i) {
          thread_pid = clone(thread_fn, thread_stack[i] + STACK_SIZE, \
            SIGCHLD, NULL);
        }
        while(1);
        return 0;
      }
      
      /*-------------------------- end --------------------------------*/
      
      Link: https://lkml.kernel.org/r/1626517201-24086-1-git-send-email-nglaive@gmail.com
      Signed-off-by: default avatarYutian Yang <nglaive@gmail.com>
      Reviewed-by: default avatarShakeel Butt <shakeelb@google.com>
      Cc: Michal Hocko <mhocko@kernel.org>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: Vladimir Davydov <vdavydov.dev@gmail.com>
      Cc: <shenwenbo@zju.edu.cn>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      aa4ecd99
    • Guenter Roeck's avatar
      Revert "ASoC: mediatek: Check for error clk pointer" · 080f371d
      Guenter Roeck authored
      This reverts commit d491a2c2 which is
      commit 9de2b928 upstream
      
      With this patch in the tree, Chromebooks running the affected hardware
      no longer boot. Bisect points to this patch, and reverting it fixes
      the problem.
      
      An analysis of the code with this patch applied shows:
      
              ret = init_clks(pdev, clk);
              if (ret)
                      return ERR_PTR(ret);
      ...
                      for (j = 0; j < MAX_CLKS && data->clk_id[j]; j++) {
                              struct clk *c = clk[data->clk_id[j]];
      
                              if (IS_ERR(c)) {
                                      dev_err(&pdev->dev, "%s: clk unavailable\n",
                                              data->name);
                                      return ERR_CAST(c);
                              }
      
                              scpd->clk[j] = c;
                      }
      
      Not all clocks in the clk_names array have to be present. Only the clocks
      in the data->clk_id array are actually needed. The code already checks if
      the required clocks are available and bails out if not. The assumption that
      all clocks have to be present is wrong, and commit 9de2b928 needs to be
      reverted.
      
      Fixes: 9de2b928
      
       ("ASoC: mediatek: Check for error clk pointer")
      Cc: Jiasheng Jiang <jiasheng@iscas.ac.cn>
      Cc: Mark Brown <broonie@kernel.org>
      Cc: James Liao <jamesjj.liao@mediatek.com>
      Cc: Kevin Hilman <khilman@baylibre.com>
      Cc: Matthias Brugger <matthias.bgg@gmail.com
      Cc: Frank Wunderlich <frank-w@public-files.de>
      Cc: Daniel Golle <daniel@makrotopia.org>
      Link: https://lore.kernel.org/lkml/20220205014755.699603-1-linux@roeck-us.net/
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      080f371d
    • Mike Marciniszyn's avatar
      IB/hfi1: Fix AIP early init panic · 4a9bd1e6
      Mike Marciniszyn authored
      commit 5f8f55b9 upstream.
      
      An early failure in hfi1_ipoib_setup_rn() can lead to the following panic:
      
        BUG: unable to handle kernel NULL pointer dereference at 00000000000001b0
        PGD 0 P4D 0
        Oops: 0002 [#1] SMP NOPTI
        Workqueue: events work_for_cpu_fn
        RIP: 0010:try_to_grab_pending+0x2b/0x140
        Code: 1f 44 00 00 41 55 41 54 55 48 89 d5 53 48 89 fb 9c 58 0f 1f 44 00 00 48 89 c2 fa 66 0f 1f 44 00 00 48 89 55 00 40 84 f6 75 77 <f0> 48 0f ba 2b 00 72 09 31 c0 5b 5d 41 5c 41 5d c3 48 89 df e8 6c
        RSP: 0018:ffffb6b3cf7cfa48 EFLAGS: 00010046
        RAX: 0000000000000246 RBX: 00000000000001b0 RCX: 0000000000000000
        RDX: 0000000000000246 RSI: 0000000000000000 RDI: 00000000000001b0
        RBP: ffffb6b3cf7cfa70 R08: 0000000000000f09 R09: 0000000000000001
        R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000000000
        R13: ffffb6b3cf7cfa90 R14: ffffffff9b2fbfc0 R15: ffff8a4fdf244690
        FS:  0000000000000000(0000) GS:ffff8a527f400000(0000) knlGS:0000000000000000
        CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
        CR2: 00000000000001b0 CR3: 00000017e2410003 CR4: 00000000007706f0
        DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
        DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
        PKRU: 55555554
        Call Trace:
         __cancel_work_timer+0x42/0x190
         ? dev_printk_emit+0x4e/0x70
         iowait_cancel_work+0x15/0x30 [hfi1]
         hfi1_ipoib_txreq_deinit+0x5a/0x220 [hfi1]
         ? dev_err+0x6c/0x90
         hfi1_ipoib_netdev_dtor+0x15/0x30 [hfi1]
         hfi1_ipoib_setup_rn+0x10e/0x150 [hfi1]
         rdma_init_netdev+0x5a/0x80 [ib_core]
         ? hfi1_ipoib_free_rdma_netdev+0x20/0x20 [hfi1]
         ipoib_intf_init+0x6c/0x350 [ib_ipoib]
         ipoib_intf_alloc+0x5c/0xc0 [ib_ipoib]
         ipoib_add_one+0xbe/0x300 [ib_ipoib]
         add_client_context+0x12c/0x1a0 [ib_core]
         enable_device_and_get+0xdc/0x1d0 [ib_core]
         ib_register_device+0x572/0x6b0 [ib_core]
         rvt_register_device+0x11b/0x220 [rdmavt]
         hfi1_register_ib_device+0x6b4/0x770 [hfi1]
         do_init_one.isra.20+0x3e3/0x680 [hfi1]
         local_pci_probe+0x41/0x90
         work_for_cpu_fn+0x16/0x20
         process_one_work+0x1a7/0x360
         ? create_worker+0x1a0/0x1a0
         worker_thread+0x1cf/0x390
         ? create_worker+0x1a0/0x1a0
         kthread+0x116/0x130
         ? kthread_flush_work_fn+0x10/0x10
         ret_from_fork+0x1f/0x40
      
      The panic happens in hfi1_ipoib_txreq_deinit() because there is a NULL
      deref when hfi1_ipoib_netdev_dtor() is called in this error case.
      
      hfi1_ipoib_txreq_init() and hfi1_ipoib_rxq_init() are self unwinding so
      fix by adjusting the error paths accordingly.
      
      Other changes:
      - hfi1_ipoib_free_rdma_netdev() is deleted including the free_netdev()
        since the netdev core code deletes calls free_netdev()
      - The switch to the accelerated entrances is moved to the success path.
      
      Cc: stable@vger.kernel.org
      Fixes: d99dc602
      
       ("IB/hfi1: Add functions to transmit datagram ipoib packets")
      Link: https://lore.kernel.org/r/1642287756-182313-4-git-send-email-mike.marciniszyn@cornelisnetworks.com
      Reviewed-by: default avatarDennis Dalessandro <dennis.dalessandro@cornelisnetworks.com>
      Signed-off-by: default avatarMike Marciniszyn <mike.marciniszyn@cornelisnetworks.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4a9bd1e6
    • Jordy Zomer's avatar
      dma-buf: heaps: Fix potential spectre v1 gadget · 5d40f1bd
      Jordy Zomer authored
      commit 92c4cfae
      
       upstream.
      
      It appears like nr could be a Spectre v1 gadget as it's supplied by a
      user and used as an array index. Prevent the contents
      of kernel memory from being leaked to userspace via speculative
      execution by using array_index_nospec.
      
      Signed-off-by: default avatarJordy Zomer <jordy@pwning.systems>
      Fixes: c02a81fb
      
       ("dma-buf: Add dma-buf heaps framework")
      Cc: <stable@vger.kernel.org> # v5.6+
      Acked-by: default avatarJohn Stultz <john.stultz@linaro.org>
      Signed-off-by: default avatarSumit Semwal <sumit.semwal@linaro.org>
       [sumits: added fixes and cc: stable tags]
      Link: https://patchwork.freedesktop.org/patch/msgid/20220129150604.3461652-1-jordy@pwning.systems
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5d40f1bd
    • Martin K. Petersen's avatar
      block: bio-integrity: Advance seed correctly for larger interval sizes · 30de3bc0
      Martin K. Petersen authored
      commit b13e0c71 upstream.
      
      Commit 309a62fa ("bio-integrity: bio_integrity_advance must update
      integrity seed") added code to update the integrity seed value when
      advancing a bio. However, it failed to take into account that the
      integrity interval might be larger than the 512-byte block layer
      sector size. This broke bio splitting on PI devices with 4KB logical
      blocks.
      
      The seed value should be advanced by bio_integrity_intervals() and not
      the number of sectors.
      
      Cc: Dmitry Monakhov <dmonakhov@openvz.org>
      Cc: stable@vger.kernel.org
      Fixes: 309a62fa
      
       ("bio-integrity: bio_integrity_advance must update integrity seed")
      Tested-by: default avatarDmitry Ivanov <dmitry.ivanov2@hpe.com>
      Reported-by: default avatarAlexey Lyashkov <alexey.lyashkov@hpe.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Link: https://lore.kernel.org/r/20220204034209.4193-1-martin.petersen@oracle.com
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      30de3bc0
    • Lang Yu's avatar
      mm/kmemleak: avoid scanning potential huge holes · 35271559
      Lang Yu authored
      commit c10a0f87
      
       upstream.
      
      When using devm_request_free_mem_region() and devm_memremap_pages() to
      add ZONE_DEVICE memory, if requested free mem region's end pfn were
      huge(e.g., 0x400000000), the node_end_pfn() will be also huge (see
      move_pfn_range_to_zone()).  Thus it creates a huge hole between
      node_start_pfn() and node_end_pfn().
      
      We found on some AMD APUs, amdkfd requested such a free mem region and
      created a huge hole.  In such a case, following code snippet was just
      doing busy test_bit() looping on the huge hole.
      
        for (pfn = start_pfn; pfn < end_pfn; pfn++) {
      	struct page *page = pfn_to_online_page(pfn);
      		if (!page)
      			continue;
      	...
        }
      
      So we got a soft lockup:
      
        watchdog: BUG: soft lockup - CPU#6 stuck for 26s! [bash:1221]
        CPU: 6 PID: 1221 Comm: bash Not tainted 5.15.0-custom #1
        RIP: 0010:pfn_to_online_page+0x5/0xd0
        Call Trace:
          ? kmemleak_scan+0x16a/0x440
          kmemleak_write+0x306/0x3a0
          ? common_file_perm+0x72/0x170
          full_proxy_write+0x5c/0x90
          vfs_write+0xb9/0x260
          ksys_write+0x67/0xe0
          __x64_sys_write+0x1a/0x20
          do_syscall_64+0x3b/0xc0
          entry_SYSCALL_64_after_hwframe+0x44/0xae
      
      I did some tests with the patch.
      
      (1) amdgpu module unloaded
      
      before the patch:
      
        real    0m0.976s
        user    0m0.000s
        sys     0m0.968s
      
      after the patch:
      
        real    0m0.981s
        user    0m0.000s
        sys     0m0.973s
      
      (2) amdgpu module loaded
      
      before the patch:
      
        real    0m35.365s
        user    0m0.000s
        sys     0m35.354s
      
      after the patch:
      
        real    0m1.049s
        user    0m0.000s
        sys     0m1.042s
      
      Link: https://lkml.kernel.org/r/20211108140029.721144-1-lang.yu@amd.com
      Signed-off-by: default avatarLang Yu <lang.yu@amd.com>
      Acked-by: default avatarDavid Hildenbrand <david@redhat.com>
      Acked-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Cc: Oscar Salvador <osalvador@suse.de>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      35271559
    • Mike Rapoport's avatar
      mm/pgtable: define pte_index so that preprocessor could recognize it · 7053188d
      Mike Rapoport authored
      commit 314c459a upstream.
      
      Since commit 974b9b2c ("mm: consolidate pte_index() and
      pte_offset_*() definitions") pte_index is a static inline and there is
      no define for it that can be recognized by the preprocessor.  As a
      result, vm_insert_pages() uses slower loop over vm_insert_page() instead
      of insert_pages() that amortizes the cost of spinlock operations when
      inserting multiple pages.
      
      Link: https://lkml.kernel.org/r/20220111145457.20748-1-rppt@kernel.org
      Fixes: 974b9b2c
      
       ("mm: consolidate pte_index() and pte_offset_*() definitions")
      Signed-off-by: default avatarMike Rapoport <rppt@linux.ibm.com>
      Reported-by: default avatarChristian Dietrich <stettberger@dokucode.de>
      Reviewed-by: default avatarKhalid Aziz <khalid.aziz@oracle.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7053188d
    • Pasha Tatashin's avatar
      mm/debug_vm_pgtable: remove pte entry from the page table · bce7f5d7
      Pasha Tatashin authored
      commit fb5222aa upstream.
      
      Patch series "page table check fixes and cleanups", v5.
      
      This patch (of 4):
      
      The pte entry that is used in pte_advanced_tests() is never removed from
      the page table at the end of the test.
      
      The issue is detected by page_table_check, to repro compile kernel with
      the following configs:
      
      CONFIG_DEBUG_VM_PGTABLE=y
      CONFIG_PAGE_TABLE_CHECK=y
      CONFIG_PAGE_TABLE_CHECK_ENFORCED=y
      
      During the boot the following BUG is printed:
      
        debug_vm_pgtable: [debug_vm_pgtable         ]: Validating architecture page table helpers
        ------------[ cut here ]------------
        kernel BUG at mm/page_table_check.c:162!
        invalid opcode: 0000 [#1] PREEMPT SMP PTI
        CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.16.0-11413-g2c271fe77d52 #3
        Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.15.0-0-g2dd4b9b3f840-prebuilt.qemu.org 04/01/2014
        ...
      
      The entry should be properly removed from the page table before the page
      is released to the free list.
      
      Link: https://lkml.kernel.org/r/20220131203249.2832273-1-pasha.tatashin@soleen.com
      Link: https://lkml.kernel.org/r/20220131203249.2832273-2-pasha.tatashin@soleen.com
      Fixes: a5c3b9ff
      
       ("mm/debug_vm_pgtable: add tests validating advanced arch page table helpers")
      Signed-off-by: default avatarPasha Tatashin <pasha.tatashin@soleen.com>
      Reviewed-by: default avatarZi Yan <ziy@nvidia.com>
      Tested-by: default avatarZi Yan <ziy@nvidia.com>
      Acked-by: default avatarDavid Rientjes <rientjes@google.com>
      Reviewed-by: default avatarAnshuman Khandual <anshuman.khandual@arm.com>
      Cc: Paul Turner <pjt@google.com>
      Cc: Wei Xu <weixugc@google.com>
      Cc: Greg Thelen <gthelen@google.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: Mike Rapoport <rppt@kernel.org>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
      Cc: Jiri Slaby <jirislaby@kernel.org>
      Cc: Muchun Song <songmuchun@bytedance.com>
      Cc: Hugh Dickins <hughd@google.com>
      Cc: <stable@vger.kernel.org>	[5.9+]
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      bce7f5d7
    • Uday Shankar's avatar
      nvme-fabrics: fix state check in nvmf_ctlr_matches_baseopts() · 2d83a746
      Uday Shankar authored
      commit 6a51abde upstream.
      
      Controller deletion/reset, immediately followed by or concurrent with
      a reconnect, is hard failing the connect attempt resulting in a
      complete loss of connectivity to the controller.
      
      In the connect request, fabrics looks for an existing controller with
      the same address components and aborts the connect if a controller
      already exists and the duplicate connect option isn't set. The match
      routine filters out controllers that are dead or dying, so they don't
      interfere with the new connect request.
      
      When NVME_CTRL_DELETING_NOIO was added, it missed updating the state
      filters in the nvmf_ctlr_matches_baseopts() routine. Thus, when in this
      new state, it's seen as a live controller and fails the connect request.
      
      Correct by adding the DELETING_NIO state to the match checks.
      
      Fixes: ecca390e
      
       ("nvme: fix deadlock in disconnect during scan_work and/or ana_work")
      Cc: <stable@vger.kernel.org> # v5.7+
      Signed-off-by: default avatarUday Shankar <ushankar@purestorage.com>
      Reviewed-by: default avatarJames Smart <jsmart2021@gmail.com>
      Reviewed-by: default avatarSagi Grimberg <sagi@grimberg.me>
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2d83a746
    • Aun-Ali Zaidi's avatar
      drm/amd/display: Force link_rate as LINK_RATE_RBR2 for 2018 15" Apple Retina panels · a0c73dbd
      Aun-Ali Zaidi authored
      commit 30fbce37 upstream.
      
      The eDP link rate reported by the DP_MAX_LINK_RATE dpcd register (0xa) is
      contradictory to the highest rate supported reported by
      EDID (0xc = LINK_RATE_RBR2). The effects of this compounded with commit
      '4a8ca46b
      
       ("drm/amd/display: Default max bpc to 16 for eDP")' results
      in no display modes being found and a dark panel.
      
      For now, simply force the maximum supported link rate for the eDP attached
      2018 15" Apple Retina panels.
      
      Additionally, we must also check the firmware revision since the device ID
      reported by the DPCD is identical to that of the more capable 16,1,
      incorrectly quirking it. We also use said firmware check to quirk the
      refreshed 15,1 models with Vega graphics as they use a slightly newer
      firmware version.
      
      Tested-by: default avatarAun-Ali Zaidi <admin@kodeit.net>
      Reviewed-by: default avatarHarry Wentland <harry.wentland@amd.com>
      Signed-off-by: default avatarAun-Ali Zaidi <admin@kodeit.net>
      Signed-off-by: default avatarAditya Garg <gargaditya08@live.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a0c73dbd
    • Nick Lopez's avatar
      drm/nouveau: fix off by one in BIOS boundary checking · f071d9fa
      Nick Lopez authored
      commit 1b777d4d
      
       upstream.
      
      Bounds checking when parsing init scripts embedded in the BIOS reject
      access to the last byte. This causes driver initialization to fail on
      Apple eMac's with GeForce 2 MX GPUs, leaving the system with no working
      console.
      
      This is probably only seen on OpenFirmware machines like PowerPC Macs
      because the BIOS image provided by OF is only the used parts of the ROM,
      not a power-of-two blocks read from PCI directly so PCs always have
      empty bytes at the end that are never accessed.
      
      Signed-off-by: default avatarNick Lopez <github@glowingmonkey.org>
      Fixes: 4d4e9907
      
       ("drm/nouveau/bios: guard against out-of-bounds accesses to image")
      Cc: <stable@vger.kernel.org> # v4.10+
      Reviewed-by: default avatarIlia Mirkin <imirkin@alum.mit.edu>
      Reviewed-by: default avatarKarol Herbst <kherbst@redhat.com>
      Signed-off-by: default avatarKarol Herbst <kherbst@redhat.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20220122081906.2633061-1-github@glowingmonkey.org
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f071d9fa
    • Shin'ichiro Kawasaki's avatar
      btrfs: fix deadlock between quota disable and qgroup rescan worker · 32747e01
      Shin'ichiro Kawasaki authored
      commit e804861b
      
       upstream.
      
      Quota disable ioctl starts a transaction before waiting for the qgroup
      rescan worker completes. However, this wait can be infinite and results
      in deadlock because of circular dependency among the quota disable
      ioctl, the qgroup rescan worker and the other task with transaction such
      as block group relocation task.
      
      The deadlock happens with the steps following:
      
      1) Task A calls ioctl to disable quota. It starts a transaction and
         waits for qgroup rescan worker completes.
      2) Task B such as block group relocation task starts a transaction and
         joins to the transaction that task A started. Then task B commits to
         the transaction. In this commit, task B waits for a commit by task A.
      3) Task C as the qgroup rescan worker starts its job and starts a
         transaction. In this transaction start, task C waits for completion
         of the transaction that task A started and task B committed.
      
      This deadlock was found with fstests test case btrfs/115 and a zoned
      null_blk device. The test case enables and disables quota, and the
      block group reclaim was triggered during the quota disable by chance.
      The deadlock was also observed by running quota enable and disable in
      parallel with 'btrfs balance' command on regular null_blk devices.
      
      An example report of the deadlock:
      
        [372.469894] INFO: task kworker/u16:6:103 blocked for more than 122 seconds.
        [372.479944]       Not tainted 5.16.0-rc8 #7
        [372.485067] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
        [372.493898] task:kworker/u16:6   state:D stack:    0 pid:  103 ppid:     2 flags:0x00004000
        [372.503285] Workqueue: btrfs-qgroup-rescan btrfs_work_helper [btrfs]
        [372.510782] Call Trace:
        [372.514092]  <TASK>
        [372.521684]  __schedule+0xb56/0x4850
        [372.530104]  ? io_schedule_timeout+0x190/0x190
        [372.538842]  ? lockdep_hardirqs_on+0x7e/0x100
        [372.547092]  ? _raw_spin_unlock_irqrestore+0x3e/0x60
        [372.555591]  schedule+0xe0/0x270
        [372.561894]  btrfs_commit_transaction+0x18bb/0x2610 [btrfs]
        [372.570506]  ? btrfs_apply_pending_changes+0x50/0x50 [btrfs]
        [372.578875]  ? free_unref_page+0x3f2/0x650
        [372.585484]  ? finish_wait+0x270/0x270
        [372.591594]  ? release_extent_buffer+0x224/0x420 [btrfs]
        [372.599264]  btrfs_qgroup_rescan_worker+0xc13/0x10c0 [btrfs]
        [372.607157]  ? lock_release+0x3a9/0x6d0
        [372.613054]  ? btrfs_qgroup_account_extent+0xda0/0xda0 [btrfs]
        [372.620960]  ? do_raw_spin_lock+0x11e/0x250
        [372.627137]  ? rwlock_bug.part.0+0x90/0x90
        [372.633215]  ? lock_is_held_type+0xe4/0x140
        [372.639404]  btrfs_work_helper+0x1ae/0xa90 [btrfs]
        [372.646268]  process_one_work+0x7e9/0x1320
        [372.652321]  ? lock_release+0x6d0/0x6d0
        [372.658081]  ? pwq_dec_nr_in_flight+0x230/0x230
        [372.664513]  ? rwlock_bug.part.0+0x90/0x90
        [372.670529]  worker_thread+0x59e/0xf90
        [372.676172]  ? process_one_work+0x1320/0x1320
        [372.682440]  kthread+0x3b9/0x490
        [372.687550]  ? _raw_spin_unlock_irq+0x24/0x50
        [372.693811]  ? set_kthread_struct+0x100/0x100
        [372.700052]  ret_from_fork+0x22/0x30
        [372.705517]  </TASK>
        [372.709747] INFO: task btrfs-transacti:2347 blocked for more than 123 seconds.
        [372.729827]       Not tainted 5.16.0-rc8 #7
        [372.745907] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
        [372.767106] task:btrfs-transacti state:D stack:    0 pid: 2347 ppid:     2 flags:0x00004000
        [372.787776] Call Trace:
        [372.801652]  <TASK>
        [372.812961]  __schedule+0xb56/0x4850
        [372.830011]  ? io_schedule_timeout+0x190/0x190
        [372.852547]  ? lockdep_hardirqs_on+0x7e/0x100
        [372.871761]  ? _raw_spin_unlock_irqrestore+0x3e/0x60
        [372.886792]  schedule+0xe0/0x270
        [372.901685]  wait_current_trans+0x22c/0x310 [btrfs]
        [372.919743]  ? btrfs_put_transaction+0x3d0/0x3d0 [btrfs]
        [372.938923]  ? finish_wait+0x270/0x270
        [372.959085]  ? join_transaction+0xc75/0xe30 [btrfs]
        [372.977706]  start_transaction+0x938/0x10a0 [btrfs]
        [372.997168]  transaction_kthread+0x19d/0x3c0 [btrfs]
        [373.013021]  ? btrfs_cleanup_transaction.isra.0+0xfc0/0xfc0 [btrfs]
        [373.031678]  kthread+0x3b9/0x490
        [373.047420]  ? _raw_spin_unlock_irq+0x24/0x50
        [373.064645]  ? set_kthread_struct+0x100/0x100
        [373.078571]  ret_from_fork+0x22/0x30
        [373.091197]  </TASK>
        [373.105611] INFO: task btrfs:3145 blocked for more than 123 seconds.
        [373.114147]       Not tainted 5.16.0-rc8 #7
        [373.120401] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
        [373.130393] task:btrfs           state:D stack:    0 pid: 3145 ppid:  3141 flags:0x00004000
        [373.140998] Call Trace:
        [373.145501]  <TASK>
        [373.149654]  __schedule+0xb56/0x4850
        [373.155306]  ? io_schedule_timeout+0x190/0x190
        [373.161965]  ? lockdep_hardirqs_on+0x7e/0x100
        [373.168469]  ? _raw_spin_unlock_irqrestore+0x3e/0x60
        [373.175468]  schedule+0xe0/0x270
        [373.180814]  wait_for_commit+0x104/0x150 [btrfs]
        [373.187643]  ? test_and_set_bit+0x20/0x20 [btrfs]
        [373.194772]  ? kmem_cache_free+0x124/0x550
        [373.201191]  ? btrfs_put_transaction+0x69/0x3d0 [btrfs]
        [373.208738]  ? finish_wait+0x270/0x270
        [373.214704]  ? __btrfs_end_transaction+0x347/0x7b0 [btrfs]
        [373.222342]  btrfs_commit_transaction+0x44d/0x2610 [btrfs]
        [373.230233]  ? join_transaction+0x255/0xe30 [btrfs]
        [373.237334]  ? btrfs_record_root_in_trans+0x4d/0x170 [btrfs]
        [373.245251]  ? btrfs_apply_pending_changes+0x50/0x50 [btrfs]
        [373.253296]  relocate_block_group+0x105/0xc20 [btrfs]
        [373.260533]  ? mutex_lock_io_nested+0x1270/0x1270
        [373.267516]  ? btrfs_wait_nocow_writers+0x85/0x180 [btrfs]
        [373.275155]  ? merge_reloc_roots+0x710/0x710 [btrfs]
        [373.283602]  ? btrfs_wait_ordered_extents+0xd30/0xd30 [btrfs]
        [373.291934]  ? kmem_cache_free+0x124/0x550
        [373.298180]  btrfs_relocate_block_group+0x35c/0x930 [btrfs]
        [373.306047]  btrfs_relocate_chunk+0x85/0x210 [btrfs]
        [373.313229]  btrfs_balance+0x12f4/0x2d20 [btrfs]
        [373.320227]  ? lock_release+0x3a9/0x6d0
        [373.326206]  ? btrfs_relocate_chunk+0x210/0x210 [btrfs]
        [373.333591]  ? lock_is_held_type+0xe4/0x140
        [373.340031]  ? rcu_read_lock_sched_held+0x3f/0x70
        [373.346910]  btrfs_ioctl_balance+0x548/0x700 [btrfs]
        [373.354207]  btrfs_ioctl+0x7f2/0x71b0 [btrfs]
        [373.360774]  ? lockdep_hardirqs_on_prepare+0x410/0x410
        [373.367957]  ? lockdep_hardirqs_on_prepare+0x410/0x410
        [373.375327]  ? btrfs_ioctl_get_supported_features+0x20/0x20 [btrfs]
        [373.383841]  ? find_held_lock+0x2c/0x110
        [373.389993]  ? lock_release+0x3a9/0x6d0
        [373.395828]  ? mntput_no_expire+0xf7/0xad0
        [373.402083]  ? lock_is_held_type+0xe4/0x140
        [373.408249]  ? vfs_fileattr_set+0x9f0/0x9f0
        [373.414486]  ? selinux_file_ioctl+0x349/0x4e0
        [373.420938]  ? trace_raw_output_lock+0xb4/0xe0
        [373.427442]  ? selinux_inode_getsecctx+0x80/0x80
        [373.434224]  ? lockdep_hardirqs_on+0x7e/0x100
        [373.440660]  ? force_qs_rnp+0x2a0/0x6b0
        [373.446534]  ? lock_is_held_type+0x9b/0x140
        [373.452763]  ? __blkcg_punt_bio_submit+0x1b0/0x1b0
        [373.459732]  ? security_file_ioctl+0x50/0x90
        [373.466089]  __x64_sys_ioctl+0x127/0x190
        [373.472022]  do_syscall_64+0x3b/0x90
        [373.477513]  entry_SYSCALL_64_after_hwframe+0x44/0xae
        [373.484823] RIP: 0033:0x7f8f4af7e2bb
        [373.490493] RSP: 002b:00007ffcbf936178 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
        [373.500197] RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 00007f8f4af7e2bb
        [373.509451] RDX: 00007ffcbf936220 RSI: 00000000c4009420 RDI: 0000000000000003
        [373.518659] RBP: 00007ffcbf93774a R08: 0000000000000013 R09: 00007f8f4b02d4e0
        [373.527872] R10: 00007f8f4ae87740 R11: 0000000000000246 R12: 0000000000000001
        [373.537222] R13: 00007ffcbf936220 R14: 0000000000000000 R15: 0000000000000002
        [373.546506]  </TASK>
        [373.550878] INFO: task btrfs:3146 blocked for more than 123 seconds.
        [373.559383]       Not tainted 5.16.0-rc8 #7
        [373.565748] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
        [373.575748] task:btrfs           state:D stack:    0 pid: 3146 ppid:  2168 flags:0x00000000
        [373.586314] Call Trace:
        [373.590846]  <TASK>
        [373.595121]  __schedule+0xb56/0x4850
        [373.600901]  ? __lock_acquire+0x23db/0x5030
        [373.607176]  ? io_schedule_timeout+0x190/0x190
        [373.613954]  schedule+0xe0/0x270
        [373.619157]  schedule_timeout+0x168/0x220
        [373.625170]  ? usleep_range_state+0x150/0x150
        [373.631653]  ? mark_held_locks+0x9e/0xe0
        [373.637767]  ? do_raw_spin_lock+0x11e/0x250
        [373.643993]  ? lockdep_hardirqs_on_prepare+0x17b/0x410
        [373.651267]  ? _raw_spin_unlock_irq+0x24/0x50
        [373.657677]  ? lockdep_hardirqs_on+0x7e/0x100
        [373.664103]  wait_for_completion+0x163/0x250
        [373.670437]  ? bit_wait_timeout+0x160/0x160
        [373.676585]  btrfs_quota_disable+0x176/0x9a0 [btrfs]
        [373.683979]  ? btrfs_quota_enable+0x12f0/0x12f0 [btrfs]
        [373.691340]  ? down_write+0xd0/0x130
        [373.696880]  ? down_write_killable+0x150/0x150
        [373.703352]  btrfs_ioctl+0x3945/0x71b0 [btrfs]
        [373.710061]  ? find_held_lock+0x2c/0x110
        [373.716192]  ? lock_release+0x3a9/0x6d0
        [373.722047]  ? __handle_mm_fault+0x23cd/0x3050
        [373.728486]  ? btrfs_ioctl_get_supported_features+0x20/0x20 [btrfs]
        [373.737032]  ? set_pte+0x6a/0x90
        [373.742271]  ? do_raw_spin_unlock+0x55/0x1f0
        [373.748506]  ? lock_is_held_type+0xe4/0x140
        [373.754792]  ? vfs_fileattr_set+0x9f0/0x9f0
        [373.761083]  ? selinux_file_ioctl+0x349/0x4e0
        [373.767521]  ? selinux_inode_getsecctx+0x80/0x80
        [373.774247]  ? __up_read+0x182/0x6e0
        [373.780026]  ? count_memcg_events.constprop.0+0x46/0x60
        [373.787281]  ? up_write+0x460/0x460
        [373.792932]  ? security_file_ioctl+0x50/0x90
        [373.799232]  __x64_sys_ioctl+0x127/0x190
        [373.805237]  do_syscall_64+0x3b/0x90
        [373.810947]  entry_SYSCALL_64_after_hwframe+0x44/0xae
        [373.818102] RIP: 0033:0x7f1383ea02bb
        [373.823847] RSP: 002b:00007fffeb4d71f8 EFLAGS: 00000202 ORIG_RAX: 0000000000000010
        [373.833641] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f1383ea02bb
        [373.842961] RDX: 00007fffeb4d7210 RSI: 00000000c0109428 RDI: 0000000000000003
        [373.852179] RBP: 0000000000000003 R08: 0000000000000003 R09: 0000000000000078
        [373.861408] R10: 00007f1383daec78 R11: 0000000000000202 R12: 00007fffeb4d874a
        [373.870647] R13: 0000000000493099 R14: 0000000000000001 R15: 0000000000000000
        [373.879838]  </TASK>
        [373.884018]
                     Showing all locks held in the system:
        [373.894250] 3 locks held by kworker/4:1/58:
        [373.900356] 1 lock held by khungtaskd/63:
        [373.906333]  #0: ffffffff8945ff60 (rcu_read_lock){....}-{1:2}, at: debug_show_all_locks+0x53/0x260
        [373.917307] 3 locks held by kworker/u16:6/103:
        [373.923938]  #0: ffff888127b4f138 ((wq_completion)btrfs-qgroup-rescan){+.+.}-{0:0}, at: process_one_work+0x712/0x1320
        [373.936555]  #1: ffff88810b817dd8 ((work_completion)(&work->normal_work)){+.+.}-{0:0}, at: process_one_work+0x73f/0x1320
        [373.951109]  #2: ffff888102dd4650 (sb_internal#2){.+.+}-{0:0}, at: btrfs_qgroup_rescan_worker+0x1f6/0x10c0 [btrfs]
        [373.964027] 2 locks held by less/1803:
        [373.969982]  #0: ffff88813ed56098 (&tty->ldisc_sem){++++}-{0:0}, at: tty_ldisc_ref_wait+0x24/0x80
        [373.981295]  #1: ffffc90000b3b2e8 (&ldata->atomic_read_lock){+.+.}-{3:3}, at: n_tty_read+0x9e2/0x1060
        [373.992969] 1 lock held by btrfs-transacti/2347:
        [373.999893]  #0: ffff88813d4887a8 (&fs_info->transaction_kthread_mutex){+.+.}-{3:3}, at: transaction_kthread+0xe3/0x3c0 [btrfs]
        [374.015872] 3 locks held by btrfs/3145:
        [374.022298]  #0: ffff888102dd4460 (sb_writers#18){.+.+}-{0:0}, at: btrfs_ioctl_balance+0xc3/0x700 [btrfs]
        [374.034456]  #1: ffff88813d48a0a0 (&fs_info->reclaim_bgs_lock){+.+.}-{3:3}, at: btrfs_balance+0xfe5/0x2d20 [btrfs]
        [374.047646]  #2: ffff88813d488838 (&fs_info->cleaner_mutex){+.+.}-{3:3}, at: btrfs_relocate_block_group+0x354/0x930 [btrfs]
        [374.063295] 4 locks held by btrfs/3146:
        [374.069647]  #0: ffff888102dd4460 (sb_writers#18){.+.+}-{0:0}, at: btrfs_ioctl+0x38b1/0x71b0 [btrfs]
        [374.081601]  #1: ffff88813d488bb8 (&fs_info->subvol_sem){+.+.}-{3:3}, at: btrfs_ioctl+0x38fd/0x71b0 [btrfs]
        [374.094283]  #2: ffff888102dd4650 (sb_internal#2){.+.+}-{0:0}, at: btrfs_quota_disable+0xc8/0x9a0 [btrfs]
        [374.106885]  #3: ffff88813d489800 (&fs_info->qgroup_ioctl_lock){+.+.}-{3:3}, at: btrfs_quota_disable+0xd5/0x9a0 [btrfs]
      
        [374.126780] =============================================
      
      To avoid the deadlock, wait for the qgroup rescan worker to complete
      before starting the transaction for the quota disable ioctl. Clear
      BTRFS_FS_QUOTA_ENABLE flag before the wait and the transaction to
      request the worker to complete. On transaction start failure, set the
      BTRFS_FS_QUOTA_ENABLE flag again. These BTRFS_FS_QUOTA_ENABLE flag
      changes can be done safely since the function btrfs_quota_disable is not
      called concurrently because of fs_info->subvol_sem.
      
      Also check the BTRFS_FS_QUOTA_ENABLE flag in qgroup_rescan_init to avoid
      another qgroup rescan worker to start after the previous qgroup worker
      completed.
      
      CC: stable@vger.kernel.org # 5.4+
      Suggested-by: default avatarNikolay Borisov <nborisov@suse.com>
      Reviewed-by: default avatarFilipe Manana <fdmanana@suse.com>
      Signed-off-by: default avatarShin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      32747e01
    • Christian Lachner's avatar
      ALSA: hda/realtek: Fix silent output on Gigabyte X570 Aorus Xtreme after reboot from Windows · aa5d4061
      Christian Lachner authored
      commit ea354196
      
       upstream.
      
      This commit switches the Gigabyte X570 Aorus Xtreme from using the
      ALC1220_FIXUP_CLEVO_P950 to the ALC1220_FIXUP_GB_X570 quirk. This fixes
      the no-audio after reboot from windows problem.
      
      BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=205275
      Signed-off-by: default avatarChristian Lachner <gladiac@gmail.com>
      Cc: <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/20220129113243.93068-4-gladiac@gmail.com
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      aa5d4061
    • Christian Lachner's avatar
      ALSA: hda/realtek: Fix silent output on Gigabyte X570S Aorus Master (newer chipset) · d4aa3a98
      Christian Lachner authored
      commit 41a86013
      
       upstream.
      
      Newer versions of the X570 Master come with a newer revision of the
      mainboard chipset - the X570S. These boards have the same ALC1220 codec
      but seem to initialize the codec with a different parameter in Coef 0x7
      which causes the output audio to be very low. We therefore write a
      known-good value to Coef 0x7 to fix that. As the value is the exact same
      as on the other X570(non-S) boards the same quirk-function can be shared
      between both generations.
      
      This commit adds the Gigabyte X570S Aorus Master to the list of boards
      using the ALC1220_FIXUP_GB_X570 quirk. This fixes both, the silent output
      and the no-audio after reboot from windows problems.
      
      This work has been tested by the folks over at the level1techs forum here:
      https://forum.level1techs.com/t/has-anybody-gotten-audio-working-in-linux-on-aorus-x570-master/154072
      
      Signed-off-by: default avatarChristian Lachner <gladiac@gmail.com>
      Cc: <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/20220129113243.93068-3-gladiac@gmail.com
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d4aa3a98
    • Christian Lachner's avatar
      ALSA: hda/realtek: Add missing fixup-model entry for Gigabyte X570 ALC1220 quirks · 3a8a8072
      Christian Lachner authored
      commit 63394a16
      
       upstream.
      
      The initial commit of the new Gigabyte X570 ALC1220 quirks lacked the
      fixup-model entry in alc882_fixup_models[]. It seemed not to cause any ill
      effects but for completeness sake this commit makes up for that.
      
      Signed-off-by: default avatarChristian Lachner <gladiac@gmail.com>
      Cc: <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/20220129113243.93068-2-gladiac@gmail.com
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3a8a8072
    • Albert Geantă's avatar
      ALSA: hda/realtek: Add quirk for ASUS GU603 · 532cde96
      Albert Geantă authored
      commit 94db9cc8
      
       upstream.
      
      The ASUS GU603 (Zephyrus M16 - SSID 1043:16b2) requires a quirk similar to
      other ASUS devices for correctly routing the 4 integrated speakers. This
      fixes it by adding a corresponding quirk entry, which connects the bass
      speakers to the proper DAC.
      
      Signed-off-by: default avatarAlbert Geantă <albertgeanta@gmail.com>
      Cc: <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/20220131010523.546386-1-albertgeanta@gmail.com
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      532cde96
    • Takashi Iwai's avatar
      ALSA: hda: realtek: Fix race at concurrent COEF updates · 410f231f
      Takashi Iwai authored
      commit b837a9f5
      
       upstream.
      
      The COEF access is done with two steps: setting the index then read or
      write the data.  When multiple COEF accesses are performed
      concurrently, the index and data might be paired unexpectedly.
      In most cases, this isn't a big problem as the COEF setup is done at
      the initialization, but some dynamic changes like the mute LED may hit
      such a race.
      
      For avoiding the racy COEF accesses, this patch introduces a new
      mutex coef_mutex to alc_spec, and wrap the COEF accessing functions
      with it.
      
      Reported-by: default avatarAlexander Sergeyev <sergeev917@gmail.com>
      Cc: <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/20220111195229.a77wrpjclqwrx4bx@localhost.localdomain
      Link: https://lore.kernel.org/r/20220131075738.24323-1-tiwai@suse.de
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      410f231f