Skip to content
  1. Oct 06, 2023
    • August Wikerfors's avatar
      ASoC: amd: yc: Fix non-functional mic on Lenovo 82QF and 82UG · fefec7fb
      August Wikerfors authored
      commit 1263cc0f upstream.
      
      Like the Lenovo 82TL and 82V2, the Lenovo 82QF (Yoga 7 14ARB7) and 82UG
      (Legion S7 16ARHA7) both need a quirk entry for the internal microphone to
      function. Commit c008323f ("ASoC: amd: yc: Fix a non-functional mic on
      Lenovo 82SJ") restricted the quirk that previously matched "82" to "82V2",
      breaking microphone functionality on these devices. Fix this by adding
      specific quirks for these models, as was done for the Lenovo 82TL.
      
      Fixes: c008323f
      
       ("ASoC: amd: yc: Fix a non-functional mic on Lenovo 82SJ")
      Closes: https://github.com/tomsom/yoga-linux/issues/51
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=208555#c780
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarAugust Wikerfors <git@augustwikerfors.se>
      Link: https://lore.kernel.org/r/20230911213409.6106-1-git@augustwikerfors.se
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      fefec7fb
    • Heiner Kallweit's avatar
      i2c: i801: unregister tco_pdev in i801_probe() error path · af57b174
      Heiner Kallweit authored
      commit 39147845 upstream.
      
      We have to unregister tco_pdev also if i2c_add_adapter() fails.
      
      Fixes: 94246930
      
       ("i2c: i801: Create iTCO device on newer Intel PCHs")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarHeiner Kallweit <hkallweit1@gmail.com>
      Reviewed-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
      Reviewed-by: default avatarJean Delvare <jdelvare@suse.de>
      Signed-off-by: default avatarWolfram Sang <wsa@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      af57b174
    • Jens Axboe's avatar
      io_uring/fs: remove sqe->rw_flags checking from LINKAT · a4f5f1e8
      Jens Axboe authored
      commit a52d4f65 upstream.
      
      This is unionized with the actual link flags, so they can of course be
      set and they will be evaluated further down. If not we fail any LINKAT
      that has to set option flags.
      
      Fixes: cf30da90
      
       ("io_uring: add support for IORING_OP_LINKAT")
      Cc: stable@vger.kernel.org
      Reported-by: default avatarThomas Leonard <talex5@gmail.com>
      Link: https://github.com/axboe/liburing/issues/955
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a4f5f1e8
    • Niklas Cassel's avatar
      ata: libata-scsi: ignore reserved bits for REPORT SUPPORTED OPERATION CODES · 47cd8207
      Niklas Cassel authored
      commit 3ef60092 upstream.
      
      For REPORT SUPPORTED OPERATION CODES command, the service action field is
      defined as bits 0-4 in the second byte in the CDB. Bits 5-7 in the second
      byte are reserved.
      
      Only look at the service action field in the second byte when determining
      if the MAINTENANCE IN opcode is a REPORT SUPPORTED OPERATION CODES command.
      
      This matches how we only look at the service action field in the second
      byte when determining if the SERVICE ACTION IN(16) opcode is a READ
      CAPACITY(16) command (reserved bits 5-7 in the second byte are ignored).
      
      Fixes: 7b203094
      
       ("libata: Add support for SCT Write Same")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarNiklas Cassel <niklas.cassel@wdc.com>
      Signed-off-by: default avatarDamien Le Moal <dlemoal@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      47cd8207
    • Damien Le Moal's avatar
      scsi: sd: Do not issue commands to suspended disks on shutdown · 2bbeebe2
      Damien Le Moal authored
      commit 99398d20
      
       upstream.
      
      If an error occurs when resuming a host adapter before the devices
      attached to the adapter are resumed, the adapter low level driver may
      remove the scsi host, resulting in a call to sd_remove() for the
      disks of the host. This in turn results in a call to sd_shutdown() which
      will issue a synchronize cache command and a start stop unit command to
      spindown the disk. sd_shutdown() issues the commands only if the device
      is not already runtime suspended but does not check the power state for
      system-wide suspend/resume. That is, the commands may be issued with the
      device in a suspended state, which causes PM resume to hang, forcing a
      reset of the machine to recover.
      
      Fix this by tracking the suspended state of a disk by introducing the
      suspended boolean field in the scsi_disk structure. This flag is set to
      true when the disk is suspended is sd_suspend_common() and resumed with
      sd_resume(). When suspended is true, sd_shutdown() is not executed from
      sd_remove().
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarDamien Le Moal <dlemoal@kernel.org>
      Reviewed-by: default avatarHannes Reinecke <hare@suse.de>
      Reviewed-by: default avatarBart Van Assche <bvanassche@acm.org>
      Reviewed-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2bbeebe2
    • Damien Le Moal's avatar
      scsi: sd: Differentiate system and runtime start/stop management · dc5ab9e1
      Damien Le Moal authored
      commit 3cc2ffe5 upstream.
      
      The underlying device and driver of a SCSI disk may have different
      system and runtime power mode control requirements. This is because
      runtime power management affects only the SCSI disk, while system level
      power management affects all devices, including the controller for the
      SCSI disk.
      
      For instance, issuing a START STOP UNIT command when a SCSI disk is
      runtime suspended and resumed is fine: the command is translated to a
      STANDBY IMMEDIATE command to spin down the ATA disk and to a VERIFY
      command to wake it up. The SCSI disk runtime operations have no effect
      on the ata port device used to connect the ATA disk. However, for
      system suspend/resume operations, the ATA port used to connect the
      device will also be suspended and resumed, with the resume operation
      requiring re-validating the device link and the device itself. In this
      case, issuing a VERIFY command to spinup the disk must be done before
      starting to revalidate the device, when the ata port is being resumed.
      In such case, we must not allow the SCSI disk driver to issue START STOP
      UNIT commands.
      
      Allow a low level driver to refine the SCSI disk start/stop management
      by differentiating system and runtime cases with two new SCSI device
      flags: manage_system_start_stop and manage_runtime_start_stop. These new
      flags replace the current manage_start_stop flag. Drivers setting the
      manage_start_stop are modifed to set both new flags, thus preserving the
      existing start/stop management behavior. For backward compatibility, the
      old manage_start_stop sysfs device attribute is kept as a read-only
      attribute showing a value of 1 for devices enabling both new flags and 0
      otherwise.
      
      Fixes: 0a858905
      
       ("ata,scsi: do not issue START STOP UNIT on resume")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarDamien Le Moal <dlemoal@kernel.org>
      Reviewed-by: default avatarHannes Reinecke <hare@suse.de>
      Tested-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
      Reviewed-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      dc5ab9e1
    • Damien Le Moal's avatar
      ata: libata-scsi: link ata port and scsi device · b1a07613
      Damien Le Moal authored
      commit fb99ef17 upstream.
      
      There is no direct device ancestry defined between an ata_device and
      its scsi device which prevents the power management code from correctly
      ordering suspend and resume operations. Create such ancestry with the
      ata device as the parent to ensure that the scsi device (child) is
      suspended before the ata device and that resume handles the ata device
      before the scsi device.
      
      The parent-child (supplier-consumer) relationship is established between
      the ata_port (parent) and the scsi device (child) with the function
      device_add_link(). The parent used is not the ata_device as the PM
      operations are defined per port and the status of all devices connected
      through that port is controlled from the port operations.
      
      The device link is established with the new function
      ata_scsi_slave_alloc(), and this function is used to define the
      ->slave_alloc callback of the scsi host template of all ata drivers.
      
      Fixes: a19a93e4
      
       ("scsi: core: pm: Rely on the device driver core for async power management")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarDamien Le Moal <dlemoal@kernel.org>
      Reviewed-by: default avatarHannes Reinecke <hare@suse.de>
      Reviewed-by: default avatarNiklas Cassel <niklas.cassel@wdc.com>
      Tested-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
      Reviewed-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Reviewed-by: default avatarJohn Garry <john.g.garry@oracle.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b1a07613
    • Tiezhu Yang's avatar
      LoongArch: Add support for 64_PCREL relocation type · 2447c5b9
      Tiezhu Yang authored
      commit b1dc55a3
      
       upstream.
      
      When build and update kernel with the latest upstream binutils and
      loongson3_defconfig, module loader fails with:
      
        kmod: zsmalloc: Unknown relocation type 109
        kmod: fuse: Unknown relocation type 109
        kmod: fuse: Unknown relocation type 109
        kmod: radeon: Unknown relocation type 109
        kmod: nf_tables: Unknown relocation type 109
        kmod: nf_tables: Unknown relocation type 109
      
      This is because the latest upstream binutils replaces a pair of ADD64
      and SUB64 with 64_PCREL, so add support for 64_PCREL relocation type.
      
      Link: https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=ecb802d02eeb
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarTiezhu Yang <yangtiezhu@loongson.cn>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2447c5b9
    • Tiezhu Yang's avatar
      LoongArch: Add support for 32_PCREL relocation type · d5725efe
      Tiezhu Yang authored
      commit c1c2ce2d
      
       upstream.
      
      When build and update kernel with the latest upstream binutils and
      loongson3_defconfig, module loader fails with:
      
        kmod: zsmalloc: Unsupport relocation type 99, please add its support.
        kmod: fuse: Unsupport relocation type 99, please add its support.
        kmod: ipmi_msghandler: Unsupport relocation type 99, please add its support.
        kmod: ipmi_msghandler: Unsupport relocation type 99, please add its support.
        kmod: pstore: Unsupport relocation type 99, please add its support.
        kmod: drm_display_helper: Unsupport relocation type 99, please add its support.
        kmod: drm_display_helper: Unsupport relocation type 99, please add its support.
        kmod: drm_display_helper: Unsupport relocation type 99, please add its support.
        kmod: fuse: Unsupport relocation type 99, please add its support.
        kmod: fat: Unsupport relocation type 99, please add its support.
      
      This is because the latest upstream binutils replaces a pair of ADD32
      and SUB32 with 32_PCREL, so add support for 32_PCREL relocation type.
      
      Link: https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=ecb802d02eeb
      Cc: <stable@vger.kernel.org>
      Co-developed-by: default avatarYouling Tang <tangyouling@loongson.cn>
      Signed-off-by: default avatarYouling Tang <tangyouling@loongson.cn>
      Signed-off-by: default avatarTiezhu Yang <yangtiezhu@loongson.cn>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d5725efe
    • Huacai Chen's avatar
      LoongArch: numa: Fix high_memory calculation · fa987492
      Huacai Chen authored
      commit 1943feec upstream.
      
      For 64bit kernel without HIGHMEM, high_memory is the virtual address of
      the highest physical address in the system. But __va(get_num_physpages()
      << PAGE_SHIFT) is not what we want for high_memory because there may be
      holes in the physical address space. On the other hand, max_low_pfn is
      calculated from memblock_end_of_DRAM(), which is exactly corresponding
      to the highest physical address, so use it for high_memory calculation.
      
      Cc: <stable@vger.kernel.org>
      Fixes: d4b6f156
      
       ("LoongArch: Add Non-Uniform Memory Access (NUMA) support")
      Signed-off-by: default avatarChong Qiao <qiaochong@loongson.cn>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      fa987492
    • Tiezhu Yang's avatar
      LoongArch: Define relocation types for ABI v2.10 · e10bf187
      Tiezhu Yang authored
      commit 27614988
      
       upstream.
      
      The relocation types from 101 to 109 are used by GNU binutils >= 2.41,
      add their definitions to use them in later patches.
      
      Link: https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=include/elf/loongarch.h#l230
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarTiezhu Yang <yangtiezhu@loongson.cn>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e10bf187
    • Helge Deller's avatar
      LoongArch: Fix lockdep static memory detection · eb9681d3
      Helge Deller authored
      commit 68ffa230 upstream.
      
      Since commit 0a6b58c5 ("lockdep: fix static memory detection even
      more") the lockdep code uses is_kernel_core_data(), is_kernel_rodata()
      and init_section_contains() to verify if a lock is located inside a
      kernel static data section.
      
      This change triggers a failure on LoongArch, for which the vmlinux.lds.S
      script misses to put the locks (as part of in the .data.rel symbols)
      into the Linux data section.
      
      This patch fixes the lockdep problem by moving *(.data.rel*) symbols
      into the kernel data section (from _sdata to _edata).
      
      Additionally, move other wrongly assigned symbols too:
      - altinstructions into the _initdata section,
      - PLT symbols behind the read-only section, and
      - *(.la_abs) into the data section.
      
      Cc: stable <stable@kernel.org> # v6.4+
      Fixes: 0a6b58c5
      
       ("lockdep: fix static memory detection even more")
      Reported-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Tested-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      eb9681d3
    • Kailang Yang's avatar
      ALSA: hda: Disable power save for solving pop issue on Lenovo ThinkCentre M70q · e9b20aa7
      Kailang Yang authored
      commit 057a28ef
      
       upstream.
      
      Lenovo ThinkCentre M70q had boot up pop noise.
      Disable power save will solve pop issue.
      
      Signed-off-by: default avatarKailang Yang <kailang@realtek.com>
      Cc: <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/315900e2efef42fd9855eacfeb443abd@realtek.com
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e9b20aa7
    • Takashi Iwai's avatar
      ALSA: rawmidi: Fix NULL dereference at proc read · d8bbfab0
      Takashi Iwai authored
      commit b2ce0027 upstream.
      
      At the implementation of the optional proc fs in rawmidi, I forgot
      that rmidi->ops itself is optional and can be NULL.
      Add the proper NULL check for avoiding the Oops.
      
      Fixes: fa030f66
      
       ("ALSA: ump: Additional proc output")
      Reported-and-tested-by: default avatarMark Hills <mark@xwax.org>
      Closes: https://lore.kernel.org/r/ef9118c3-a2eb-d0ff-1efa-cc5fb6416bde@xwax.org
      Cc: <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/20230916060725.11726-1-tiwai@suse.de
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d8bbfab0
    • Tianjia Zhang's avatar
      crypto: sm2 - Fix crash caused by uninitialized context · 3eb82c2b
      Tianjia Zhang authored
      commit 21155620 upstream.
      
      In sm2_compute_z_digest() function, the newly allocated structure
      mpi_ec_ctx is used, but forget to initialize it, which will cause
      a crash when performing subsequent operations.
      
      Fixes: e5221fa6
      
       ("KEYS: asymmetric: Move sm2 code into x509_public_key")
      Cc: stable@vger.kernel.org # v6.5
      Signed-off-by: default avatarTianjia Zhang <tianjia.zhang@linux.alibaba.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3eb82c2b
    • Pan Bian's avatar
      nilfs2: fix potential use after free in nilfs_gccache_submit_read_data() · 28df4646
      Pan Bian authored
      commit 7ee29fac upstream.
      
      In nilfs_gccache_submit_read_data(), brelse(bh) is called to drop the
      reference count of bh when the call to nilfs_dat_translate() fails.  If
      the reference count hits 0 and its owner page gets unlocked, bh may be
      freed.  However, bh->b_page is dereferenced to put the page after that,
      which may result in a use-after-free bug.  This patch moves the release
      operation after unlocking and putting the page.
      
      NOTE: The function in question is only called in GC, and in combination
      with current userland tools, address translation using DAT does not occur
      in that function, so the code path that causes this issue will not be
      executed.  However, it is possible to run that code path by intentionally
      modifying the userland GC library or by calling the GC ioctl directly.
      
      [konishi.ryusuke@gmail.com: NOTE added to the commit log]
      Link: https://lkml.kernel.org/r/1543201709-53191-1-git-send-email-bianpan2016@163.com
      Link: https://lkml.kernel.org/r/20230921141731.10073-1-konishi.ryusuke@gmail.com
      Fixes: a3d93f70
      
       ("nilfs2: block cache for garbage collection")
      Signed-off-by: default avatarPan Bian <bianpan2016@163.com>
      Reported-by: default avatarFerry Meng <mengferry@linux.alibaba.com>
      Closes: https://lkml.kernel.org/r/20230818092022.111054-1-mengferry@linux.alibaba.com
      Signed-off-by: default avatarRyusuke Konishi <konishi.ryusuke@gmail.com>
      Tested-by: default avatarRyusuke Konishi <konishi.ryusuke@gmail.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      28df4646
    • Andy Shevchenko's avatar
      serial: 8250_port: Check IRQ data before use · 3345cc5f
      Andy Shevchenko authored
      commit cce7fc8b upstream.
      
      In case the leaf driver wants to use IRQ polling (irq = 0) and
      IIR register shows that an interrupt happened in the 8250 hardware
      the IRQ data can be NULL. In such a case we need to skip the wake
      event as we came to this path from the timer interrupt and quite
      likely system is already awake.
      
      Without this fix we have got an Oops:
      
          serial8250: ttyS0 at I/O 0x3f8 (irq = 0, base_baud = 115200) is a 16550A
          ...
          BUG: kernel NULL pointer dereference, address: 0000000000000010
          RIP: 0010:serial8250_handle_irq+0x7c/0x240
          Call Trace:
           ? serial8250_handle_irq+0x7c/0x240
           ? __pfx_serial8250_timeout+0x10/0x10
      
      Fixes: 0ba9e3a1
      
       ("serial: 8250: Add missing wakeup event reporting")
      Cc: stable <stable@kernel.org>
      Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Reviewed-by: default avatarFlorian Fainelli <florian.fainelli@broadcom.com>
      Link: https://lore.kernel.org/r/20230831222555.614426-1-andriy.shevchenko@linux.intel.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3345cc5f
    • Damien Le Moal's avatar
      scsi: core: ata: Do no try to probe for CDL on old drives · 37ee7bd2
      Damien Le Moal authored
      commit 2132df16
      
       upstream.
      
      Some old drives (e.g. an Ultra320 SCSI disk as reported by John) do not
      seem to execute MAINTENANCE_IN / MI_REPORT_SUPPORTED_OPERATION_CODES
      commands correctly and hang when a non-zero service action is specified
      (one command format with service action case in scsi_report_opcode()).
      
      Currently, CDL probing with scsi_cdl_check_cmd() is the only caller using a
      non zero service action for scsi_report_opcode(). To avoid issues with
      these old drives, do not attempt CDL probe if the device reports support
      for an SPC version lower than 5 (CDL was introduced in SPC-5). To keep
      things working with ATA devices which probe for the CDL T2A and T2B pages
      introduced with SPC-6, modify ata_scsiop_inq_std() to claim SPC-6 version
      compatibility for ATA drives supporting CDL.
      
      SPC-6 standard version number is defined as Dh (= 13) in SPC-6 r09. Fix
      scsi_probe_lun() to correctly capture this value by changing the bit mask
      for the second byte of the INQUIRY response from 0x7 to 0xf.
      include/scsi/scsi.h is modified to add the definition SCSI_SPC_6 with the
      value 14 (Dh + 1). The missing definitions for the SCSI_SPC_4 and
      SCSI_SPC_5 versions are also added.
      
      Reported-by: default avatarJohn David Anglin <dave.anglin@bell.net>
      Fixes: 62488520
      
       ("scsi: core: Detect support for command duration limits")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarDamien Le Moal <dlemoal@kernel.org>
      Link: https://lore.kernel.org/r/20230915022034.678121-1-dlemoal@kernel.org
      Tested-by: default avatarDavid Gow <david@davidgow.net>
      Reviewed-by: default avatarBart Van Assche <bvanassche@acm.org>
      Reviewed-by: default avatarNiklas Cassel <niklas.cassel@wdc.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      37ee7bd2
    • Daniel Starke's avatar
      Revert "tty: n_gsm: fix UAF in gsm_cleanup_mux" · 2bff660e
      Daniel Starke authored
      commit 29346e21 upstream.
      
      This reverts commit 9b9c8195.
      
      The commit above is reverted as it did not solve the original issue.
      
      gsm_cleanup_mux() tries to free up the virtual ttys by calling
      gsm_dlci_release() for each available DLCI. There, dlci_put() is called to
      decrease the reference counter for the DLCI via tty_port_put() which
      finally calls gsm_dlci_free(). This already clears the pointer which is
      being checked in gsm_cleanup_mux() before calling gsm_dlci_release().
      Therefore, it is not necessary to clear this pointer in gsm_cleanup_mux()
      as done in the reverted commit. The commit introduces a null pointer
      dereference:
       <TASK>
       ? __die+0x1f/0x70
       ? page_fault_oops+0x156/0x420
       ? search_exception_tables+0x37/0x50
       ? fixup_exception+0x21/0x310
       ? exc_page_fault+0x69/0x150
       ? asm_exc_page_fault+0x26/0x30
       ? tty_port_put+0x19/0xa0
       gsmtty_cleanup+0x29/0x80 [n_gsm]
       release_one_tty+0x37/0xe0
       process_one_work+0x1e6/0x3e0
       worker_thread+0x4c/0x3d0
       ? __pfx_worker_thread+0x10/0x10
       kthread+0xe1/0x110
       ? __pfx_kthread+0x10/0x10
       ret_from_fork+0x2f/0x50
       ? __pfx_kthread+0x10/0x10
       ret_from_fork_asm+0x1b/0x30
       </TASK>
      
      The actual issue is that nothing guards dlci_put() from being called
      multiple times while the tty driver was triggered but did not yet finished
      calling gsm_dlci_free().
      
      Fixes: 9b9c8195
      
       ("tty: n_gsm: fix UAF in gsm_cleanup_mux")
      Cc: stable <stable@kernel.org>
      Signed-off-by: default avatarDaniel Starke <daniel.starke@siemens.com>
      Link: https://lore.kernel.org/r/20230914051507.3240-1-daniel.starke@siemens.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2bff660e
    • Ricky WU's avatar
      misc: rtsx: Fix some platforms can not boot and move the l1ss judgment to probe · f8d2e642
      Ricky WU authored
      commit 0e4cac55 upstream.
      
      commit 101bd907 ("misc: rtsx: judge ASPM Mode to set PETXCFG Reg")
      some readers no longer force #CLKREQ to low
      when the system need to enter ASPM.
      But some platform maybe not implement complete ASPM?
      it causes some platforms can not boot
      
      Like in the past only the platform support L1ss we release the #CLKREQ.
      Move the judgment (L1ss) to probe,
      we think read config space one time when the driver start is enough
      
      Fixes: 101bd907
      
       ("misc: rtsx: judge ASPM Mode to set PETXCFG Reg")
      Cc: stable <stable@kernel.org>
      Reported-by: default avatarPaul Grandperrin <paul.grandperrin@gmail.com>
      Signed-off-by: default avatarRicky Wu <ricky_wu@realtek.com>
      Tested-By: default avatarJade Lovelace <lists@jade.fyi>
      Link: https://lore.kernel.org/r/37b1afb997f14946a8784c73d1f9a4f5@realtek.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f8d2e642
    • Paolo Abeni's avatar
      mptcp: process pending subflow error on close · 02447cd8
      Paolo Abeni authored
      commit 9f1a9881 upstream.
      
      On incoming TCP reset, subflow closing could happen before error
      propagation. That in turn could cause the socket error being ignored,
      and a missing socket state transition, as reported by Daire-Byrne.
      
      Address the issues explicitly checking for subflow socket error at
      close time. To avoid code duplication, factor-out of __mptcp_error_report()
      a new helper implementing the relevant bits.
      
      Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/429
      Fixes: 15cc1045
      
       ("mptcp: deliver ssk errors to msk")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Reviewed-by: default avatarMat Martineau <martineau@kernel.org>
      Signed-off-by: default avatarMatthieu Baerts <matthieu.baerts@tessares.net>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      02447cd8
    • Paolo Abeni's avatar
      mptcp: move __mptcp_error_report in protocol.c · 6be989cb
      Paolo Abeni authored
      commit d5fbeff1
      
       upstream.
      
      This will simplify the next patch ("mptcp: process pending subflow error
      on close").
      
      No functional change intended.
      
      Cc: stable@vger.kernel.org # v5.12+
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Reviewed-by: default avatarMat Martineau <martineau@kernel.org>
      Signed-off-by: default avatarMatthieu Baerts <matthieu.baerts@tessares.net>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6be989cb
    • Paolo Abeni's avatar
      mptcp: fix bogus receive window shrinkage with multiple subflows · 2bef7c8c
      Paolo Abeni authored
      commit 6bec0411 upstream.
      
      In case multiple subflows race to update the mptcp-level receive
      window, the subflow losing the race should use the window value
      provided by the "winning" subflow to update it's own tcp-level
      rcv_wnd.
      
      To such goal, the current code bogusly uses the mptcp-level rcv_wnd
      value as observed before the update attempt. On unlucky circumstances
      that may lead to TCP-level window shrinkage, and stall the other end.
      
      Address the issue feeding to the rcv wnd update the correct value.
      
      Fixes: f3589be0
      
       ("mptcp: never shrink offered window")
      Cc: stable@vger.kernel.org
      Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/427
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Reviewed-by: default avatarMat Martineau <martineau@kernel.org>
      Signed-off-by: default avatarMatthieu Baerts <matthieu.baerts@tessares.net>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2bef7c8c
    • Sean Christopherson's avatar
      KVM: x86/mmu: Stop zapping invalidated TDP MMU roots asynchronously · 9e52fd59
      Sean Christopherson authored
      commit 0df9dab8
      
       upstream.
      
      Stop zapping invalidate TDP MMU roots via work queue now that KVM
      preserves TDP MMU roots until they are explicitly invalidated.  Zapping
      roots asynchronously was effectively a workaround to avoid stalling a vCPU
      for an extended during if a vCPU unloaded a root, which at the time
      happened whenever the guest toggled CR0.WP (a frequent operation for some
      guest kernels).
      
      While a clever hack, zapping roots via an unbound worker had subtle,
      unintended consequences on host scheduling, especially when zapping
      multiple roots, e.g. as part of a memslot.  Because the work of zapping a
      root is no longer bound to the task that initiated the zap, things like
      the CPU affinity and priority of the original task get lost.  Losing the
      affinity and priority can be especially problematic if unbound workqueues
      aren't affined to a small number of CPUs, as zapping multiple roots can
      cause KVM to heavily utilize the majority of CPUs in the system, *beyond*
      the CPUs KVM is already using to run vCPUs.
      
      When deleting a memslot via KVM_SET_USER_MEMORY_REGION, the async root
      zap can result in KVM occupying all logical CPUs for ~8ms, and result in
      high priority tasks not being scheduled in in a timely manner.  In v5.15,
      which doesn't preserve unloaded roots, the issues were even more noticeable
      as KVM would zap roots more frequently and could occupy all CPUs for 50ms+.
      
      Consuming all CPUs for an extended duration can lead to significant jitter
      throughout the system, e.g. on ChromeOS with virtio-gpu, deleting memslots
      is a semi-frequent operation as memslots are deleted and recreated with
      different host virtual addresses to react to host GPU drivers allocating
      and freeing GPU blobs.  On ChromeOS, the jitter manifests as audio blips
      during games due to the audio server's tasks not getting scheduled in
      promptly, despite the tasks having a high realtime priority.
      
      Deleting memslots isn't exactly a fast path and should be avoided when
      possible, and ChromeOS is working towards utilizing MAP_FIXED to avoid the
      memslot shenanigans, but KVM is squarely in the wrong.  Not to mention
      that removing the async zapping eliminates a non-trivial amount of
      complexity.
      
      Note, one of the subtle behaviors hidden behind the async zapping is that
      KVM would zap invalidated roots only once (ignoring partial zaps from
      things like mmu_notifier events).  Preserve this behavior by adding a flag
      to identify roots that are scheduled to be zapped versus roots that have
      already been zapped but not yet freed.
      
      Add a comment calling out why kvm_tdp_mmu_invalidate_all_roots() can
      encounter invalid roots, as it's not at all obvious why zapping
      invalidated roots shouldn't simply zap all invalid roots.
      
      Reported-by: default avatarPattara Teerapong <pteerapong@google.com>
      Cc: David Stevens <stevensd@google.com>
      Cc: Yiwei Zhang<zzyiwei@google.com>
      Cc: Paul Hsia <paulhsia@google.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
      Message-Id: <20230916003916.2545000-4-seanjc@google.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9e52fd59
    • Paolo Bonzini's avatar
      KVM: x86/mmu: Do not filter address spaces in for_each_tdp_mmu_root_yield_safe() · f1f5d279
      Paolo Bonzini authored
      commit 441a5dfc
      
       upstream.
      
      All callers except the MMU notifier want to process all address spaces.
      Remove the address space ID argument of for_each_tdp_mmu_root_yield_safe()
      and switch the MMU notifier to use __for_each_tdp_mmu_root_yield_safe().
      
      Extracted out of a patch by Sean Christopherson <seanjc@google.com>
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f1f5d279
    • Sean Christopherson's avatar
      KVM: x86/mmu: Open code leaf invalidation from mmu_notifier · f654c202
      Sean Christopherson authored
      commit 50107e8b
      
       upstream.
      
      The mmu_notifier path is a bit of a special snowflake, e.g. it zaps only a
      single address space (because it's per-slot), and can't always yield.
      Because of this, it calls kvm_tdp_mmu_zap_leafs() in ways that no one
      else does.
      
      Iterate manually over the leafs in response to an mmu_notifier
      invalidation, instead of invoking kvm_tdp_mmu_zap_leafs().  Drop the
      @can_yield param from kvm_tdp_mmu_zap_leafs() as its sole remaining
      caller unconditionally passes "true".
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
      Message-Id: <20230916003916.2545000-2-seanjc@google.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f654c202
    • Tom Lendacky's avatar
      KVM: SVM: Fix TSC_AUX virtualization setup · c416989d
      Tom Lendacky authored
      commit e0096d01 upstream.
      
      The checks for virtualizing TSC_AUX occur during the vCPU reset processing
      path. However, at the time of initial vCPU reset processing, when the vCPU
      is first created, not all of the guest CPUID information has been set. In
      this case the RDTSCP and RDPID feature support for the guest is not in
      place and so TSC_AUX virtualization is not established.
      
      This continues for each vCPU created for the guest. On the first boot of
      an AP, vCPU reset processing is executed as a result of an APIC INIT
      event, this time with all of the guest CPUID information set, resulting
      in TSC_AUX virtualization being enabled, but only for the APs. The BSP
      always sees a TSC_AUX value of 0 which probably went unnoticed because,
      at least for Linux, the BSP TSC_AUX value is 0.
      
      Move the TSC_AUX virtualization enablement out of the init_vmcb() path and
      into the vcpu_after_set_cpuid() path to allow for proper initialization of
      the support after the guest CPUID information has been set.
      
      With the TSC_AUX virtualization support now in the vcpu_set_after_cpuid()
      path, the intercepts must be either cleared or set based on the guest
      CPUID input.
      
      Fixes: 296d5a17
      
       ("KVM: SEV-ES: Use V_TSC_AUX if available instead of RDTSC/MSR_TSC_AUX intercepts")
      Signed-off-by: default avatarTom Lendacky <thomas.lendacky@amd.com>
      Message-Id: <4137fbcb9008951ab5f0befa74a0399d2cce809a.1694811272.git.thomas.lendacky@amd.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c416989d
    • Paolo Bonzini's avatar
      KVM: SVM: INTERCEPT_RDTSCP is never intercepted anyway · 822425a9
      Paolo Bonzini authored
      commit e8d93d5d upstream.
      
      svm_recalc_instruction_intercepts() is always called at least once
      before the vCPU is started, so the setting or clearing of the RDTSCP
      intercept can be dropped from the TSC_AUX virtualization support.
      
      Extracted from a patch by Tom Lendacky.
      
      Cc: stable@vger.kernel.org
      Fixes: 296d5a17
      
       ("KVM: SEV-ES: Use V_TSC_AUX if available instead of RDTSC/MSR_TSC_AUX intercepts")
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      822425a9
    • Pu Wen's avatar
      x86/srso: Add SRSO mitigation for Hygon processors · cf43b304
      Pu Wen authored
      commit a5ef7d68
      
       upstream.
      
      Add mitigation for the speculative return stack overflow vulnerability
      which exists on Hygon processors too.
      
      Signed-off-by: default avatarPu Wen <puwen@hygon.cn>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Acked-by: default avatarBorislav Petkov (AMD) <bp@alien8.de>
      Cc: <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/tencent_4A14812842F104E93AA722EC939483CEFF05@qq.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      cf43b304
    • Haitao Huang's avatar
      x86/sgx: Resolves SECS reclaim vs. page fault for EAUG race · 1348f7f1
      Haitao Huang authored
      commit c6c2adcb upstream.
      
      The SGX EPC reclaimer (ksgxd) may reclaim the SECS EPC page for an
      enclave and set secs.epc_page to NULL. The SECS page is used for EAUG
      and ELDU in the SGX page fault handler. However, the NULL check for
      secs.epc_page is only done for ELDU, not EAUG before being used.
      
      Fix this by doing the same NULL check and reloading of the SECS page as
      needed for both EAUG and ELDU.
      
      The SECS page holds global enclave metadata. It can only be reclaimed
      when there are no other enclave pages remaining. At that point,
      virtually nothing can be done with the enclave until the SECS page is
      paged back in.
      
      An enclave can not run nor generate page faults without a resident SECS
      page. But it is still possible for a #PF for a non-SECS page to race
      with paging out the SECS page: when the last resident non-SECS page A
      triggers a #PF in a non-resident page B, and then page A and the SECS
      both are paged out before the #PF on B is handled.
      
      Hitting this bug requires that race triggered with a #PF for EAUG.
      Following is a trace when it happens.
      
      BUG: kernel NULL pointer dereference, address: 0000000000000000
      RIP: 0010:sgx_encl_eaug_page+0xc7/0x210
      Call Trace:
       ? __kmem_cache_alloc_node+0x16a/0x440
       ? xa_load+0x6e/0xa0
       sgx_vma_fault+0x119/0x230
       __do_fault+0x36/0x140
       do_fault+0x12f/0x400
       __handle_mm_fault+0x728/0x1110
       handle_mm_fault+0x105/0x310
       do_user_addr_fault+0x1ee/0x750
       ? __this_cpu_preempt_check+0x13/0x20
       exc_page_fault+0x76/0x180
       asm_exc_page_fault+0x27/0x30
      
      Fixes: 5a90d2c3
      
       ("x86/sgx: Support adding of pages to an initialized enclave")
      Signed-off-by: default avatarHaitao Huang <haitao.huang@linux.intel.com>
      Signed-off-by: default avatarDave Hansen <dave.hansen@linux.intel.com>
      Reviewed-by: default avatarJarkko Sakkinen <jarkko@kernel.org>
      Reviewed-by: default avatarKai Huang <kai.huang@intel.com>
      Acked-by: default avatarReinette Chatre <reinette.chatre@intel.com>
      Cc:stable@vger.kernel.org
      Link: https://lore.kernel.org/all/20230728051024.33063-1-haitao.huang%40linux.intel.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1348f7f1
    • Johan Hovold's avatar
      spi: zynqmp-gqspi: fix clock imbalance on probe failure · 3d0d8a6e
      Johan Hovold authored
      commit 1527b076 upstream.
      
      Make sure that the device is not runtime suspended before explicitly
      disabling the clocks on probe failure and on driver unbind to avoid a
      clock enable-count imbalance.
      
      Fixes: 9e3a0003
      
       ("spi: zynqmp: Add pm runtime support")
      Cc: stable@vger.kernel.org	# 4.19
      Cc: Naga Sureshkumar Relli <naga.sureshkumar.relli@xilinx.com>
      Cc: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
      Signed-off-by: default avatarJohan Hovold <johan+linaro@kernel.org>
      Link: https://lore.kernel.org/r/Message-Id: <20230622082435.7873-1-johan+linaro@kernel.org>
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3d0d8a6e
    • Nicolin Chen's avatar
      iommu/arm-smmu-v3: Fix soft lockup triggered by arm_smmu_mm_invalidate_range · 3283a1bc
      Nicolin Chen authored
      commit d5afb4b4 upstream.
      
      When running an SVA case, the following soft lockup is triggered:
      --------------------------------------------------------------------
      watchdog: BUG: soft lockup - CPU#244 stuck for 26s!
      pstate: 83400009 (Nzcv daif +PAN -UAO +TCO +DIT -SSBS BTYPE=--)
      pc : arm_smmu_cmdq_issue_cmdlist+0x178/0xa50
      lr : arm_smmu_cmdq_issue_cmdlist+0x150/0xa50
      sp : ffff8000d83ef290
      x29: ffff8000d83ef290 x28: 000000003b9aca00 x27: 0000000000000000
      x26: ffff8000d83ef3c0 x25: da86c0812194a0e8 x24: 0000000000000000
      x23: 0000000000000040 x22: ffff8000d83ef340 x21: ffff0000c63980c0
      x20: 0000000000000001 x19: ffff0000c6398080 x18: 0000000000000000
      x17: 0000000000000000 x16: 0000000000000000 x15: ffff3000b4a3bbb0
      x14: ffff3000b4a30888 x13: ffff3000b4a3cf60 x12: 0000000000000000
      x11: 0000000000000000 x10: 0000000000000000 x9 : ffffc08120e4d6bc
      x8 : 0000000000000000 x7 : 0000000000000000 x6 : 0000000000048cfa
      x5 : 0000000000000000 x4 : 0000000000000001 x3 : 000000000000000a
      x2 : 0000000080000000 x1 : 0000000000000000 x0 : 0000000000000001
      Call trace:
       arm_smmu_cmdq_issue_cmdlist+0x178/0xa50
       __arm_smmu_tlb_inv_range+0x118/0x254
       arm_smmu_tlb_inv_range_asid+0x6c/0x130
       arm_smmu_mm_invalidate_range+0xa0/0xa4
       __mmu_notifier_invalidate_range_end+0x88/0x120
       unmap_vmas+0x194/0x1e0
       unmap_region+0xb4/0x144
       do_mas_align_munmap+0x290/0x490
       do_mas_munmap+0xbc/0x124
       __vm_munmap+0xa8/0x19c
       __arm64_sys_munmap+0x28/0x50
       invoke_syscall+0x78/0x11c
       el0_svc_common.constprop.0+0x58/0x1c0
       do_el0_svc+0x34/0x60
       el0_svc+0x2c/0xd4
       el0t_64_sync_handler+0x114/0x140
       el0t_64_sync+0x1a4/0x1a8
      --------------------------------------------------------------------
      
      The commit 06ff87ba
      
       ("arm64: mm: remove unused functions and variable
      protoypes") fixed a similar lockup on the CPU MMU side. Yet, it can occur
      to SMMU too since arm_smmu_mm_invalidate_range() is typically called next
      to MMU tlb flush function, e.g.
      	tlb_flush_mmu_tlbonly {
      		tlb_flush {
      			__flush_tlb_range {
      				// check MAX_TLBI_OPS
      			}
      		}
      		mmu_notifier_invalidate_range {
      			arm_smmu_mm_invalidate_range {
      				// does not check MAX_TLBI_OPS
      			}
      		}
      	}
      
      Clone a CMDQ_MAX_TLBI_OPS from the MAX_TLBI_OPS in tlbflush.h, since in an
      SVA case SMMU uses the CPU page table, so it makes sense to align with the
      tlbflush code. Then, replace per-page TLBI commands with a single per-asid
      TLBI command, if the request size hits this threshold.
      
      Signed-off-by: default avatarNicolin Chen <nicolinc@nvidia.com>
      Link: https://lore.kernel.org/r/20230920052257.8615-1-nicolinc@nvidia.com
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      3283a1bc
    • Richard Fitzgerald's avatar
      ASoC: cs35l56: Call pm_runtime_dont_use_autosuspend() · 71c7428d
      Richard Fitzgerald authored
      commit ec038045
      
       upstream
      
      Driver remove() must call pm_runtime_dont_use_autosuspend().
      
      Drivers that call pm_runtime_use_autosuspend() must disable
      it in driver remove(). Unfortunately until recently this was
      only mentioned in 1 line in a 900+ line document so most
      people hadn't noticed this. It has only recently been added
      to the kerneldoc of pm_runtime_use_autosuspend().
      
      Backport note: This is the same change as the upstream
      commit but the cs35l56->base.dev argument in the upstream
      code is cs35l56->dev in older releases.
      
      Signed-off-by: default avatarRichard Fitzgerald <rf@opensource.cirrus.com>
      Link: https://lore.kernel.org/r/20230908101716.2658582-1-rf@opensource.cirrus.com
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      71c7428d
    • Arnaldo Carvalho de Melo's avatar
      perf build: Define YYNOMEM as YYNOABORT for bison < 3.81 · 2f0d613b
      Arnaldo Carvalho de Melo authored
      [ Upstream commit 88cc47e2
      
       ]
      
      YYNOMEM was introduced in bison 3.81, so define it as YYABORT for older
      versions, which should provide the previous perf behaviour.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      2f0d613b
    • Thomas Zimmermann's avatar
      fbdev/sh7760fb: Depend on FB=y · c8745e60
      Thomas Zimmermann authored
      [ Upstream commit f75f71b2
      
       ]
      
      Fix linker error if FB=m about missing fb_io_read and fb_io_write. The
      linker's error message suggests that this config setting has already
      been broken for other symbols.
      
        All errors (new ones prefixed by >>):
      
           sh4-linux-ld: drivers/video/fbdev/sh7760fb.o: in function `sh7760fb_probe':
           sh7760fb.c:(.text+0x374): undefined reference to `framebuffer_alloc'
           sh4-linux-ld: sh7760fb.c:(.text+0x394): undefined reference to `fb_videomode_to_var'
           sh4-linux-ld: sh7760fb.c:(.text+0x39c): undefined reference to `fb_alloc_cmap'
           sh4-linux-ld: sh7760fb.c:(.text+0x3a4): undefined reference to `register_framebuffer'
           sh4-linux-ld: sh7760fb.c:(.text+0x3ac): undefined reference to `fb_dealloc_cmap'
           sh4-linux-ld: sh7760fb.c:(.text+0x434): undefined reference to `framebuffer_release'
           sh4-linux-ld: drivers/video/fbdev/sh7760fb.o: in function `sh7760fb_remove':
           sh7760fb.c:(.text+0x800): undefined reference to `unregister_framebuffer'
           sh4-linux-ld: sh7760fb.c:(.text+0x804): undefined reference to `fb_dealloc_cmap'
           sh4-linux-ld: sh7760fb.c:(.text+0x814): undefined reference to `framebuffer_release'
        >> sh4-linux-ld: drivers/video/fbdev/sh7760fb.o:(.rodata+0xc): undefined reference to `fb_io_read'
        >> sh4-linux-ld: drivers/video/fbdev/sh7760fb.o:(.rodata+0x10): undefined reference to `fb_io_write'
           sh4-linux-ld: drivers/video/fbdev/sh7760fb.o:(.rodata+0x2c): undefined reference to `cfb_fillrect'
           sh4-linux-ld: drivers/video/fbdev/sh7760fb.o:(.rodata+0x30): undefined reference to `cfb_copyarea'
           sh4-linux-ld: drivers/video/fbdev/sh7760fb.o:(.rodata+0x34): undefined reference to `cfb_imageblit'
      
      Suggested-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Reported-by: default avatarkernel test robot <lkp@intel.com>
      Closes: https://lore.kernel.org/oe-kbuild-all/202309130632.LS04CPWu-lkp@intel.com/
      Signed-off-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
      Reviewed-by: default avatarJavier Martinez Canillas <javierm@redhat.com>
      Acked-by: default avatarJohn Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
      Link: https://patchwork.freedesktop.org/patch/msgid/20230918090400.13264-1-tzimmermann@suse.de
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      c8745e60
    • Huacai Chen's avatar
      LoongArch: Set all reserved memblocks on Node#0 at initialization · 19878758
      Huacai Chen authored
      [ Upstream commit b795fb9f ]
      
      After commit 61167ad5
      
       ("mm: pass nid to reserve_bootmem_region()")
      we get a panic if DEFERRED_STRUCT_PAGE_INIT is enabled:
      
      [    0.000000] CPU 0 Unable to handle kernel paging request at virtual address 0000000000002b82, era == 90000000040e3f28, ra == 90000000040e3f18
      [    0.000000] Oops[#1]:
      [    0.000000] CPU: 0 PID: 0 Comm: swapper Not tainted 6.5.0+ #733
      [    0.000000] pc 90000000040e3f28 ra 90000000040e3f18 tp 90000000046f4000 sp 90000000046f7c90
      [    0.000000] a0 0000000000000001 a1 0000000000200000 a2 0000000000000040 a3 90000000046f7ca0
      [    0.000000] a4 90000000046f7ca4 a5 0000000000000000 a6 90000000046f7c38 a7 0000000000000000
      [    0.000000] t0 0000000000000002 t1 9000000004b00ac8 t2 90000000040e3f18 t3 90000000040f0800
      [    0.000000] t4 00000000000f0000 t5 80000000ffffe07e t6 0000000000000003 t7 900000047fff5e20
      [    0.000000] t8 aaaaaaaaaaaaaaab u0 0000000000000018 s9 0000000000000000 s0 fffffefffe000000
      [    0.000000] s1 0000000000000000 s2 0000000000000080 s3 0000000000000040 s4 0000000000000000
      [    0.000000] s5 0000000000000000 s6 fffffefffe000000 s7 900000000470b740 s8 9000000004ad4000
      [    0.000000]    ra: 90000000040e3f18 reserve_bootmem_region+0xec/0x21c
      [    0.000000]   ERA: 90000000040e3f28 reserve_bootmem_region+0xfc/0x21c
      [    0.000000]  CRMD: 000000b0 (PLV0 -IE -DA +PG DACF=CC DACM=CC -WE)
      [    0.000000]  PRMD: 00000000 (PPLV0 -PIE -PWE)
      [    0.000000]  EUEN: 00000000 (-FPE -SXE -ASXE -BTE)
      [    0.000000]  ECFG: 00070800 (LIE=11 VS=7)
      [    0.000000] ESTAT: 00010800 [PIL] (IS=11 ECode=1 EsubCode=0)
      [    0.000000]  BADV: 0000000000002b82
      [    0.000000]  PRID: 0014d000 (Loongson-64bit, Loongson-3A6000)
      [    0.000000] Modules linked in:
      [    0.000000] Process swapper (pid: 0, threadinfo=(____ptrval____), task=(____ptrval____))
      [    0.000000] Stack : 0000000000000000 9000000002eb5430 0000003a00000020 90000000045ccd00
      [    0.000000]         900000000470e000 90000000002c1918 0000000000000000 9000000004110780
      [    0.000000]         00000000fe6c0000 0000000480000000 9000000004b4e368 9000000004110748
      [    0.000000]         0000000000000000 900000000421ca84 9000000004620000 9000000004564970
      [    0.000000]         90000000046f7d78 9000000002cc9f70 90000000002c1918 900000000470e000
      [    0.000000]         9000000004564970 90000000040bc0e0 90000000046f7d78 0000000000000000
      [    0.000000]         0000000000004000 90000000045ccd00 0000000000000000 90000000002c1918
      [    0.000000]         90000000002c1900 900000000470b700 9000000004b4df78 9000000004620000
      [    0.000000]         90000000046200a8 90000000046200a8 0000000000000000 9000000004218b2c
      [    0.000000]         9000000004270008 0000000000000001 0000000000000000 90000000045ccd00
      [    0.000000]         ...
      [    0.000000] Call Trace:
      [    0.000000] [<90000000040e3f28>] reserve_bootmem_region+0xfc/0x21c
      [    0.000000] [<900000000421ca84>] memblock_free_all+0x114/0x350
      [    0.000000] [<9000000004218b2c>] mm_core_init+0x138/0x3cc
      [    0.000000] [<9000000004200e38>] start_kernel+0x488/0x7a4
      [    0.000000] [<90000000040df0d8>] kernel_entry+0xd8/0xdc
      [    0.000000]
      [    0.000000] Code: 02eb21ad  00410f4c  380c31ac <262b818d> 6800b70d  02c1c196  0015001c  57fe4bb1  260002cd
      
      The reason is early memblock_reserve() in memblock_init() set node id to
      MAX_NUMNODES, making NODE_DATA(nid) a NULL dereference in the call chain
      reserve_bootmem_region() -> init_reserved_page(). After memblock_init(),
      those late calls of memblock_reserve() operate on subregions of memblock
      .memory regions. As a result, these reserved regions will be set to the
      correct node at the first iteration of memmap_init_reserved_pages().
      
      So set all reserved memblocks on Node#0 at initialization can avoid this
      panic.
      
      Reported-by: default avatarWANG Xuerui <git@xen0n.name>
      Tested-by: default avatarWANG Xuerui <git@xen0n.name>
      Reviewed-by: WANG Xuerui <git@xen0n.name>  # with nits addressed
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      19878758
    • Andy Shevchenko's avatar
      LoongArch: Use _UL() and _ULL() · 560e4941
      Andy Shevchenko authored
      [ Upstream commit 3563b477
      
       ]
      
      Use _UL() and _ULL() that are provided by const.h.
      
      Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      560e4941
    • Yann Sionneau's avatar
      i2c: designware: fix __i2c_dw_disable() in case master is holding SCL low · 55aba54d
      Yann Sionneau authored
      [ Upstream commit 2409205a
      
       ]
      
      The DesignWare IP can be synthesized with the IC_EMPTYFIFO_HOLD_MASTER_EN
      parameter.
      In this case, when the TX FIFO gets empty and the last command didn't have
      the STOP bit (IC_DATA_CMD[9]), the controller will hold SCL low until
      a new command is pushed into the TX FIFO or the transfer is aborted.
      
      When the controller is holding SCL low, it cannot be disabled.
      The transfer must first be aborted.
      Also, the bus recovery won't work because SCL is held low by the master.
      
      Check if the master is holding SCL low in __i2c_dw_disable() before trying
      to disable the controller. If SCL is held low, an abort is initiated.
      When the abort is done, then proceed with disabling the controller.
      
      This whole situation can happen for instance during SMBus read data block
      if the slave just responds with "byte count == 0".
      This puts the driver in an unrecoverable state, because the controller is
      holding SCL low and the current __i2c_dw_disable() procedure is not
      working. In this situation only a SoC reset can fix the i2c bus.
      
      Co-developed-by: default avatarJonathan Borne <jborne@kalray.eu>
      Signed-off-by: default avatarJonathan Borne <jborne@kalray.eu>
      Signed-off-by: default avatarYann Sionneau <ysionneau@kalray.eu>
      Acked-by: default avatarJarkko Nikula <jarkko.nikula@linux.intel.com>
      Signed-off-by: default avatarWolfram Sang <wsa@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      55aba54d
    • Bob Peterson's avatar
      gfs2: fix glock shrinker ref issues · 73ab6230
      Bob Peterson authored
      [ Upstream commit 62862485
      
       ]
      
      Before this patch, function gfs2_scan_glock_lru would only try to free
      glocks that had a reference count of 0. But if the reference count ever
      got to 0, the glock should have already been freed.
      
      Shrinker function gfs2_dispose_glock_lru checks whether glocks on the
      LRU are demote_ok, and if so, tries to demote them. But that's only
      possible if the reference count is at least 1.
      
      This patch changes gfs2_scan_glock_lru so it will try to demote and/or
      dispose of glocks that have a reference count of 1 and which are either
      demotable, or are already unlocked.
      
      Signed-off-by: default avatarBob Peterson <rpeterso@redhat.com>
      Signed-off-by: default avatarAndreas Gruenbacher <agruenba@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      73ab6230
    • Gerhard Engleder's avatar
      tsnep: Fix NAPI polling with budget 0 · f057b2c7
      Gerhard Engleder authored
      [ Upstream commit 46589db3
      
       ]
      
      According to the NAPI documentation networking/napi.rst, Rx specific
      APIs like page pool and XDP cannot be used at all when budget is 0.
      skb Tx processing should happen regardless of the budget.
      
      Stop NAPI polling after Tx processing and skip Rx processing if budget
      is 0.
      
      Signed-off-by: default avatarGerhard Engleder <gerhard@engleder-embedded.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      f057b2c7