Skip to content
Snippets Groups Projects
  1. Jan 14, 2023
  2. Jan 12, 2023
    • Greg Kroah-Hartman's avatar
    • Baochen Qiang's avatar
      wifi: ath11k: Send PME message during wakeup from D3cold · 177055b9
      Baochen Qiang authored
      
      commit 3f9b09cc upstream.
      
      We are seeing system stuck on some specific platforms due to
      WLAN chip fails to wakeup from D3cold state.
      
      With this flag, firmware will send PME message during wakeup
      and this issue is gone.
      
      Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3
      
      Signed-off-by: default avatarBaochen Qiang <quic_bqiang@quicinc.com>
      Signed-off-by: default avatarKalle Valo <quic_kvalo@quicinc.com>
      Cc: "Limonciello, Mario" <Mario.Limonciello@amd.com>
      Link: https://lore.kernel.org/r/20221010033237.415478-1-quic_bqiang@quicinc.com
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      177055b9
    • Ard Biesheuvel's avatar
      efi: random: combine bootloader provided RNG seed with RNG protocol output · 15f818d4
      Ard Biesheuvel authored
      
      commit 196dff27 upstream.
      
      Instead of blindly creating the EFI random seed configuration table if
      the RNG protocol is implemented and works, check whether such a EFI
      configuration table was provided by an earlier boot stage and if so,
      concatenate the existing and the new seeds, leaving it up to the core
      code to mix it in and credit it the way it sees fit.
      
      This can be used for, e.g., systemd-boot, to pass an additional seed to
      Linux in a way that can be consumed by the kernel very early. In that
      case, the following definitions should be used to pass the seed to the
      EFI stub:
      
      struct linux_efi_random_seed {
            u32     size; // of the 'seed' array in bytes
            u8      seed[];
      };
      
      The memory for the struct must be allocated as EFI_ACPI_RECLAIM_MEMORY
      pool memory, and the address of the struct in memory should be installed
      as a EFI configuration table using the following GUID:
      
      LINUX_EFI_RANDOM_SEED_TABLE_GUID        1ce1e5bc-7ceb-42f2-81e5-8aadf180f57b
      
      Note that doing so is safe even on kernels that were built without this
      patch applied, but the seed will simply be overwritten with a seed
      derived from the EFI RNG protocol, if available. The recommended seed
      size is 32 bytes, and seeds larger than 512 bytes are considered
      corrupted and ignored entirely.
      
      In order to preserve forward secrecy, seeds from previous bootloaders
      are memzero'd out, and in order to preserve memory, those older seeds
      are also freed from memory. Freeing from memory without first memzeroing
      is not safe to do, as it's possible that nothing else will ever
      overwrite those pages used by EFI.
      
      Reviewed-by: default avatarJason A. Donenfeld <Jason@zx2c4.com>
      [ardb: incorporate Jason's followup changes to extend the maximum seed
             size on the consumer end, memzero() it and drop a needless printk]
      Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
      Signed-off-by: default avatarJason A. Donenfeld <Jason@zx2c4.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      15f818d4
    • Jani Nikula's avatar
      drm/i915/dsi: fix MIPI_BKLT_EN_1 native GPIO index · 0c84b7de
      Jani Nikula authored
      
      commit 6217e9f0 upstream.
      
      Due to copy-paste fail, MIPI_BKLT_EN_1 would always use PPS index 1,
      never 0. Fix the sloppiest commit in recent memory.
      
      Fixes: 963bbdb3 ("drm/i915/dsi: add support for ICL+ native MIPI GPIO sequence")
      Reported-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
      Reviewed-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20221220140105.313333-1-jani.nikula@intel.com
      
      
      (cherry picked from commit a561933c)
      Cc: stable@vger.kernel.org # 6.1
      Signed-off-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0c84b7de
    • Jani Nikula's avatar
      drm/i915/dsi: add support for ICL+ native MIPI GPIO sequence · c7229577
      Jani Nikula authored
      commit 963bbdb3 upstream.
      
      Starting from ICL, the default for MIPI GPIO sequences seems to be using
      native GPIOs i.e. GPIOs available in the GPU. These native GPIOs reuse
      many pins that quite frankly seem scary to poke based on the VBT
      sequences. We pretty much have to trust that the board is configured
      such that the relevant HPD, PP_CONTROL and GPIO bits aren't used for
      anything else.
      
      MIPI sequence v4 also adds a flag to fall back to non-native sequences.
      
      v5:
      - Wrap SHOTPLUG_CTL_DDI modification in spin_lock() in icp_irq_handler()
        too (Ville)
      - References instead of Closes issue 6131 because this does not fix everything
      
      v4:
      - Wrap SHOTPLUG_CTL_DDI modification in spin_lock_irq() (Ville)
      
      v3:
      - Fix -Wbitwise-conditional-parentheses (kernel test robot <lkp@intel.com>)
      
      v2:
      - Fix HPD pin output set (impacts GPIOs 0 and 5)
      - Fix GPIO data output direction set (impacts GPIOs 4 and 9)
      - Reduce register accesses to single intel_de_rwm()
      
      References: https://gitlab.freedesktop.org/drm/intel/-/issues/6131
      
      
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
      Reviewed-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20221219105955.4014451-1-jani.nikula@intel.com
      
      
      (cherry picked from commit f087cfe6)
      Cc: stable@vger.kernel.org # 6.1
      Signed-off-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c7229577
    • William Liu's avatar
      ksmbd: check nt_len to be at least CIFS_ENCPWD_SIZE in ksmbd_decode_ntlmssp_auth_blob · 5e7d97db
      William Liu authored
      
      commit 797805d8 upstream.
      
      "nt_len - CIFS_ENCPWD_SIZE" is passed directly from
      ksmbd_decode_ntlmssp_auth_blob to ksmbd_auth_ntlmv2. Malicious requests
      can set nt_len to less than CIFS_ENCPWD_SIZE, which results in a negative
      number (or large unsigned value) used for a subsequent memcpy in
      ksmbd_auth_ntlvm2 and can cause a panic.
      
      Fixes: e2f34481 ("cifsd: add server-side procedures for SMB3")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarWilliam Liu <will@willsroot.io>
      Signed-off-by: default avatarHrvoje Mišetić <misetichrvoje@gmail.com>
      Acked-by: default avatarNamjae Jeon <linkinjeon@kernel.org>
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5e7d97db
    • Marios Makassikis's avatar
      ksmbd: send proper error response in smb2_tree_connect() · ad678f30
      Marios Makassikis authored
      
      commit cdfb2fef upstream.
      
      Currently, smb2_tree_connect doesn't send an error response packet on
      error.
      
      This causes libsmb2 to skip the specific error code and fail with the
      following:
       smb2_service failed with : Failed to parse fixed part of command
       payload. Unexpected size of Error reply. Expected 9, got 8
      
      Signed-off-by: default avatarMarios Makassikis <mmakassikis@freebox.fr>
      Acked-by: default avatarNamjae Jeon <linkinjeon@kernel.org>
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ad678f30
    • Namjae Jeon's avatar
      ksmbd: fix infinite loop in ksmbd_conn_handler_loop() · 4cd43172
      Namjae Jeon authored
      
      commit 83dcedd5 upstream.
      
      If kernel_recvmsg() return -EAGAIN in ksmbd_tcp_readv() and go round
      again, It will cause infinite loop issue. And all threads from next
      connections would be doing that. This patch add max retry count(2) to
      avoid it. kernel_recvmsg() will wait during 7sec timeout and try to
      retry two time if -EAGAIN is returned. And add flags of kvmalloc to
      __GFP_NOWARN and __GFP_NORETRY to disconnect immediately without
      retrying on memory alloation failure.
      
      Fixes: 0626e664 ("cifsd: add server handler for central processing and tranport layers")
      Cc: stable@vger.kernel.org
      Reported-by: zdi-disclosures@trendmicro.com # ZDI-CAN-18259
      Reviewed-by: default avatarSergey Senozhatsky <senozhatsky@chromium.org>
      Signed-off-by: default avatarNamjae Jeon <linkinjeon@kernel.org>
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4cd43172
    • Qu Wenruo's avatar
      btrfs: handle case when repair happens with dev-replace · 53e9d685
      Qu Wenruo authored
      
      [ Upstream commit d73a27b8 ]
      
      [BUG]
      There is a bug report that a BUG_ON() in btrfs_repair_io_failure()
      (originally repair_io_failure() in v6.0 kernel) got triggered when
      replacing a unreliable disk:
      
        BTRFS warning (device sda1): csum failed root 257 ino 2397453 off 39624704 csum 0xb0d18c75 expected csum 0x4dae9c5e mirror 3
        kernel BUG at fs/btrfs/extent_io.c:2380!
        invalid opcode: 0000 [#1] PREEMPT SMP NOPTI
        CPU: 9 PID: 3614331 Comm: kworker/u257:2 Tainted: G           OE      6.0.0-5-amd64 #1  Debian 6.0.10-2
        Hardware name: Micro-Star International Co., Ltd. MS-7C60/TRX40 PRO WIFI (MS-7C60), BIOS 2.70 07/01/2021
        Workqueue: btrfs-endio btrfs_end_bio_work [btrfs]
        RIP: 0010:repair_io_failure+0x24a/0x260 [btrfs]
        Call Trace:
         <TASK>
         clean_io_failure+0x14d/0x180 [btrfs]
         end_bio_extent_readpage+0x412/0x6e0 [btrfs]
         ? __switch_to+0x106/0x420
         process_one_work+0x1c7/0x380
         worker_thread+0x4d/0x380
         ? rescuer_thread+0x3a0/0x3a0
         kthread+0xe9/0x110
         ? kthread_complete_and_exit+0x20/0x20
         ret_from_fork+0x22/0x30
      
      [CAUSE]
      
      Before the BUG_ON(), we got some read errors from the replace target
      first, note the mirror number (3, which is beyond RAID1 duplication,
      thus it's read from the replace target device).
      
      Then at the BUG_ON() location, we are trying to writeback the repaired
      sectors back the failed device.
      
      The check looks like this:
      
      		ret = btrfs_map_block(fs_info, BTRFS_MAP_WRITE, logical,
      				      &map_length, &bioc, mirror_num);
      		if (ret)
      			goto out_counter_dec;
      		BUG_ON(mirror_num != bioc->mirror_num);
      
      But inside btrfs_map_block(), we can modify bioc->mirror_num especially
      for dev-replace:
      
      	if (dev_replace_is_ongoing && mirror_num == map->num_stripes + 1 &&
      	    !need_full_stripe(op) && dev_replace->tgtdev != NULL) {
      		ret = get_extra_mirror_from_replace(fs_info, logical, *length,
      						    dev_replace->srcdev->devid,
      						    &mirror_num,
      					    &physical_to_patch_in_first_stripe);
      		patch_the_first_stripe_for_dev_replace = 1;
      	}
      
      Thus if we're repairing the replace target device, we're going to
      trigger that BUG_ON().
      
      But in reality, the read failure from the replace target device may be
      that, our replace hasn't reached the range we're reading, thus we're
      reading garbage, but with replace running, the range would be properly
      filled later.
      
      Thus in that case, we don't need to do anything but let the replace
      routine to handle it.
      
      [FIX]
      Instead of a BUG_ON(), just skip the repair if we're repairing the
      device replace target device.
      
      Reported-by: default avatar小太 <nospam@kota.moe>
      Link: https://lore.kernel.org/linux-btrfs/CACsxjPYyJGQZ+yvjzxA1Nn2LuqkYqTCcUH43S=+wXhyf8S00Ag@mail.gmail.com/
      
      
      CC: stable@vger.kernel.org # 6.0+
      Signed-off-by: default avatarQu Wenruo <wqu@suse.com>
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      53e9d685
    • Samson Tam's avatar
      drm/amd/display: Uninitialized variables causing 4k60 UCLK to stay at DPM1 and not DPM0 · d179f9d2
      Samson Tam authored
      
      [ Upstream commit f3c23bea ]
      
      [Why]
      SwathSizePerSurfaceY[] and SwathSizePerSurfaceC[] values are uninitialized
       because we are using += instead of = operator.
      
      [How]
      Assign values in loop with = operator.
      
      Acked-by: default avatarAurabindo Pillai <aurabindo.pillai@amd.com>
      Signed-off-by: default avatarSamson Tam <samson.tam@amd.com>
      Reviewed-by: default avatarAric Cyr <aric.cyr@amd.com>
      Tested-by: default avatarDaniel Wheeler <daniel.wheeler@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Cc: stable@vger.kernel.org # 6.0.x, 6.1.x
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      d179f9d2
    • Dillon Varone's avatar
      drm/amd/display: Add check for DET fetch latency hiding for dcn32 · 4ac1437d
      Dillon Varone authored
      
      [ Upstream commit 6d4727c8 ]
      
      [WHY?]
      Some configurations are constructed with very marginal DET buffers relative to
      the worst possible time required to fetch a swath.
      
      [HOW?]
      Add a check to see that the DET buffer allocated for each pipe can hide the
      latency for all pipes to fetch at least one swath.
      
      Reviewed-by: default avatarAlvin Lee <Alvin.Lee2@amd.com>
      Reviewed-by: default avatarJun Lei <Jun.Lei@amd.com>
      Acked-by: default avatarBrian Chang <Brian.Chang@amd.com>
      Signed-off-by: default avatarDillon Varone <Dillon.Varone@amd.com>
      Tested-by: default avatarDaniel Wheeler <daniel.wheeler@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Stable-dep-of: f3c23bea ("drm/amd/display: Uninitialized variables causing 4k60 UCLK to stay at DPM1 and not DPM0")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      4ac1437d
    • Rafael Mendonca's avatar
      virtio_blk: Fix signedness bug in virtblk_prep_rq() · bff553de
      Rafael Mendonca authored
      
      [ Upstream commit a26116c1 ]
      
      The virtblk_map_data() function returns negative error codes, however, the
      'nents' field of vbr->sg_table is an unsigned int, which causes the error
      handling not to work correctly.
      
      Cc: stable@vger.kernel.org
      Fixes: 0e9911fa ("virtio-blk: support mq_ops->queue_rqs()")
      Signed-off-by: default avatarRafael Mendonca <rafaelmendsr@gmail.com>
      Message-Id: <20221021204126.927603-1-rafaelmendsr@gmail.com>
      Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Reviewed-by: default avatarStefano Garzarella <sgarzare@redhat.com>
      Reviewed-by: default avatarSuwan Kim <suwan.kim027@gmail.com>
      Reviewed-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
      Acked-by: default avatarJason Wang <jasowang@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      bff553de
    • Dmitry Fomichev's avatar
      virtio-blk: use a helper to handle request queuing errors · 569b4f8f
      Dmitry Fomichev authored
      
      [ Upstream commit 258896fc ]
      
      Define a new helper function, virtblk_fail_to_queue(), to
      clean up the error handling code in virtio_queue_rq().
      
      Signed-off-by: default avatarDmitry Fomichev <dmitry.fomichev@wdc.com>
      Message-Id: <20221016034127.330942-2-dmitry.fomichev@wdc.com>
      Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Stable-dep-of: a26116c1 ("virtio_blk: Fix signedness bug in virtblk_prep_rq()")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      569b4f8f
    • Zhenyu Wang's avatar
      drm/i915/gvt: fix vgpu debugfs clean in remove · 44c0e07e
      Zhenyu Wang authored
      
      commit 704f3384 upstream.
      
      Check carefully on root debugfs available when destroying vgpu,
      e.g in remove case drm minor's debugfs root might already be destroyed,
      which led to kernel oops like below.
      
      Console: switching to colour dummy device 80x25
      i915 0000:00:02.0: MDEV: Unregistering
      intel_vgpu_mdev b1338b2d-a709-4c23-b766-cc436c36cdf0: Removing from iommu group 14
      BUG: kernel NULL pointer dereference, address: 0000000000000150
      PGD 0 P4D 0
      Oops: 0000 [#1] PREEMPT SMP
      CPU: 3 PID: 1046 Comm: driverctl Not tainted 6.1.0-rc2+ #6
      Hardware name: HP HP ProDesk 600 G3 MT/829D, BIOS P02 Ver. 02.44 09/13/2022
      RIP: 0010:__lock_acquire+0x5e2/0x1f90
      Code: 87 ad 09 00 00 39 05 e1 1e cc 02 0f 82 f1 09 00 00 ba 01 00 00 00 48 83 c4 48 89 d0 5b 5d 41 5c 41 5d 41 5e 41 5f c3 45 31 ff <48> 81 3f 60 9e c2 b6 45 0f 45 f8 83 fe 01 0f 87 55 fa ff ff 89 f0
      RSP: 0018:ffff9f770274f948 EFLAGS: 00010046
      RAX: 0000000000000003 RBX: 0000000000000000 RCX: 0000000000000000
      RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000150
      RBP: 0000000000000000 R08: 0000000000000001 R09: 0000000000000000
      R10: ffff8895d1173300 R11: 0000000000000001 R12: 0000000000000000
      R13: 0000000000000150 R14: 0000000000000000 R15: 0000000000000000
      FS:  00007fc9b2ba0740(0000) GS:ffff889cdfcc0000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 0000000000000150 CR3: 000000010fd93005 CR4: 00000000003706e0
      DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      Call Trace:
       <TASK>
       lock_acquire+0xbf/0x2b0
       ? simple_recursive_removal+0xa5/0x2b0
       ? lock_release+0x13d/0x2d0
       down_write+0x2a/0xd0
       ? simple_recursive_removal+0xa5/0x2b0
       simple_recursive_removal+0xa5/0x2b0
       ? start_creating.part.0+0x110/0x110
       ? _raw_spin_unlock+0x29/0x40
       debugfs_remove+0x40/0x60
       intel_gvt_debugfs_remove_vgpu+0x15/0x30 [kvmgt]
       intel_gvt_destroy_vgpu+0x60/0x100 [kvmgt]
       intel_vgpu_release_dev+0xe/0x20 [kvmgt]
       device_release+0x30/0x80
       kobject_put+0x79/0x1b0
       device_release_driver_internal+0x1b8/0x230
       bus_remove_device+0xec/0x160
       device_del+0x189/0x400
       ? up_write+0x9c/0x1b0
       ? mdev_device_remove_common+0x60/0x60 [mdev]
       mdev_device_remove_common+0x22/0x60 [mdev]
       mdev_device_remove_cb+0x17/0x20 [mdev]
       device_for_each_child+0x56/0x80
       mdev_unregister_parent+0x5a/0x81 [mdev]
       intel_gvt_clean_device+0x2d/0xe0 [kvmgt]
       intel_gvt_driver_remove+0x2e/0xb0 [i915]
       i915_driver_remove+0xac/0x100 [i915]
       i915_pci_remove+0x1a/0x30 [i915]
       pci_device_remove+0x31/0xa0
       device_release_driver_internal+0x1b8/0x230
       unbind_store+0xd8/0x100
       kernfs_fop_write_iter+0x156/0x210
       vfs_write+0x236/0x4a0
       ksys_write+0x61/0xd0
       do_syscall_64+0x55/0x80
       ? find_held_lock+0x2b/0x80
       ? lock_release+0x13d/0x2d0
       ? up_read+0x17/0x20
       ? lock_is_held_type+0xe3/0x140
       ? asm_exc_page_fault+0x22/0x30
       ? lockdep_hardirqs_on+0x7d/0x100
       entry_SYSCALL_64_after_hwframe+0x46/0xb0
      RIP: 0033:0x7fc9b2c9e0c4
      Code: 15 71 7d 0d 00 f7 d8 64 89 02 48 c7 c0 ff ff ff ff eb b7 0f 1f 00 f3 0f 1e fa 80 3d 3d 05 0e 00 00 74 13 b8 01 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 54 c3 0f 1f 00 48 83 ec 28 48 89 54 24 18 48
      RSP: 002b:00007ffec29c81c8 EFLAGS: 00000202 ORIG_RAX: 0000000000000001
      RAX: ffffffffffffffda RBX: 000000000000000d RCX: 00007fc9b2c9e0c4
      RDX: 000000000000000d RSI: 0000559f8b5f48a0 RDI: 0000000000000001
      RBP: 0000559f8b5f48a0 R08: 0000559f8b5f3540 R09: 00007fc9b2d76d30
      R10: 0000000000000000 R11: 0000000000000202 R12: 000000000000000d
      R13: 00007fc9b2d77780 R14: 000000000000000d R15: 00007fc9b2d72a00
       </TASK>
      Modules linked in: sunrpc intel_rapl_msr intel_rapl_common intel_pmc_core_pltdrv intel_pmc_core intel_tcc_cooling x86_pkg_temp_thermal intel_powerclamp coretemp kvm_intel ee1004 igbvf rapl vfat fat intel_cstate intel_uncore pktcdvd i2c_i801 pcspkr wmi_bmof i2c_smbus acpi_pad vfio_pci vfio_pci_core vfio_virqfd zram fuse dm_multipath kvmgt mdev vfio_iommu_type1 vfio kvm irqbypass i915 nvme e1000e igb nvme_core crct10dif_pclmul crc32_pclmul crc32c_intel polyval_clmulni polyval_generic serio_raw ghash_clmulni_intel sha512_ssse3 dca drm_buddy intel_gtt video wmi drm_display_helper ttm
      CR2: 0000000000000150
      ---[ end trace 0000000000000000 ]---
      
      Cc: Wang Zhi <zhi.a.wang@intel.com>
      Cc: He Yu <yu.he@intel.com>
      Cc: Alex Williamson <alex.williamson@redhat.com>
      Cc: stable@vger.kernel.org
      Reviewed-by: default avatarZhi Wang <zhi.a.wang@intel.com>
      Tested-by: default avatarYu He <yu.he@intel.com>
      Fixes: bc7b0be3 ("drm/i915/gvt: Add basic debugfs infrastructure")
      Signed-off-by: default avatarZhenyu Wang <zhenyuw@linux.intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/20221219140357.769557-2-zhenyuw@linux.intel.com
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      44c0e07e
    • Zhenyu Wang's avatar
      drm/i915/gvt: fix gvt debugfs destroy · fe340500
      Zhenyu Wang authored
      
      commit c4b850d1 upstream.
      
      When gvt debug fs is destroyed, need to have a sane check if drm
      minor's debugfs root is still available or not, otherwise in case like
      device remove through unbinding, drm minor's debugfs directory has
      already been removed, then intel_gvt_debugfs_clean() would act upon
      dangling pointer like below oops.
      
      i915 0000:00:02.0: Direct firmware load for i915/gvt/vid_0x8086_did_0x1926_rid_0x0a.golden_hw_state failed with error -2
      i915 0000:00:02.0: MDEV: Registered
      Console: switching to colour dummy device 80x25
      i915 0000:00:02.0: MDEV: Unregistering
      BUG: kernel NULL pointer dereference, address: 00000000000000a0
      PGD 0 P4D 0
      Oops: 0002 [#1] PREEMPT SMP PTI
      CPU: 2 PID: 2486 Comm: gfx-unbind.sh Tainted: G          I        6.1.0-rc8+ #15
      Hardware name: Dell Inc. XPS 13 9350/0JXC1H, BIOS 1.13.0 02/10/2020
      RIP: 0010:down_write+0x1f/0x90
      Code: 1d ff ff 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 53 48 89 fb e8 62 c0 ff ff bf 01 00 00 00 e8 28 5e 31 ff 31 c0 ba 01 00 00 00 <f0> 48 0f b1 13 75 33 65 48 8b 04 25 c0 bd 01 00 48 89 43 08 bf 01
      RSP: 0018:ffff9eb3036ffcc8 EFLAGS: 00010246
      RAX: 0000000000000000 RBX: 00000000000000a0 RCX: ffffff8100000000
      RDX: 0000000000000001 RSI: 0000000000000064 RDI: ffffffffa48787a8
      RBP: ffff9eb3036ffd30 R08: ffffeb1fc45a0608 R09: ffffeb1fc45a05c0
      R10: 0000000000000002 R11: 0000000000000000 R12: 0000000000000000
      R13: ffff91acc33fa328 R14: ffff91acc033f080 R15: ffff91acced533e0
      FS:  00007f6947bba740(0000) GS:ffff91ae36d00000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 00000000000000a0 CR3: 00000001133a2002 CR4: 00000000003706e0
      Call Trace:
       <TASK>
       simple_recursive_removal+0x9f/0x2a0
       ? start_creating.part.0+0x120/0x120
       ? _raw_spin_lock+0x13/0x40
       debugfs_remove+0x40/0x60
       intel_gvt_debugfs_clean+0x15/0x30 [kvmgt]
       intel_gvt_clean_device+0x49/0xe0 [kvmgt]
       intel_gvt_driver_remove+0x2f/0xb0
       i915_driver_remove+0xa4/0xf0
       i915_pci_remove+0x1a/0x30
       pci_device_remove+0x33/0xa0
       device_release_driver_internal+0x1b2/0x230
       unbind_store+0xe0/0x110
       kernfs_fop_write_iter+0x11b/0x1f0
       vfs_write+0x203/0x3d0
       ksys_write+0x63/0xe0
       do_syscall_64+0x37/0x90
       entry_SYSCALL_64_after_hwframe+0x63/0xcd
      RIP: 0033:0x7f6947cb5190
      Code: 40 00 48 8b 15 71 9c 0d 00 f7 d8 64 89 02 48 c7 c0 ff ff ff ff eb b7 0f 1f 00 80 3d 51 24 0e 00 00 74 17 b8 01 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 58 c3 0f 1f 80 00 00 00 00 48 83 ec 28 48 89
      RSP: 002b:00007ffcbac45a28 EFLAGS: 00000202 ORIG_RAX: 0000000000000001
      RAX: ffffffffffffffda RBX: 000000000000000d RCX: 00007f6947cb5190
      RDX: 000000000000000d RSI: 0000555e35c866a0 RDI: 0000000000000001
      RBP: 0000555e35c866a0 R08: 0000000000000002 R09: 0000555e358cb97c
      R10: 0000000000000000 R11: 0000000000000202 R12: 0000000000000001
      R13: 000000000000000d R14: 0000000000000000 R15: 0000555e358cb8e0
       </TASK>
      Modules linked in: kvmgt
      CR2: 00000000000000a0
      ---[ end trace 0000000000000000 ]---
      
      Cc: Wang, Zhi <zhi.a.wang@intel.com>
      Cc: He, Yu <yu.he@intel.com>
      Cc: stable@vger.kernel.org
      Reviewed-by: default avatarZhi Wang <zhi.a.wang@intel.com>
      Fixes: bc7b0be3 ("drm/i915/gvt: Add basic debugfs infrastructure")
      Signed-off-by: default avatarZhenyu Wang <zhenyuw@linux.intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/20221219140357.769557-1-zhenyuw@linux.intel.com
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      fe340500
    • Mukul Joshi's avatar
      drm/amdkfd: Fix kernel warning during topology setup · 306888b1
      Mukul Joshi authored
      
      commit cf97eb7e upstream.
      
      This patch fixes the following kernel warning seen during
      driver load by correctly initializing the p2plink attr before
      creating the sysfs file:
      
      [  +0.002865] ------------[ cut here ]------------
      [  +0.002327] kobject: '(null)' (0000000056260cfb): is not initialized, yet kobject_put() is being called.
      [  +0.004780] WARNING: CPU: 32 PID: 1006 at lib/kobject.c:718 kobject_put+0xaa/0x1c0
      [  +0.001361] Call Trace:
      [  +0.001234]  <TASK>
      [  +0.001067]  kfd_remove_sysfs_node_entry+0x24a/0x2d0 [amdgpu]
      [  +0.003147]  kfd_topology_update_sysfs+0x3d/0x750 [amdgpu]
      [  +0.002890]  kfd_topology_add_device+0xbd7/0xc70 [amdgpu]
      [  +0.002844]  ? lock_release+0x13c/0x2e0
      [  +0.001936]  ? smu_cmn_send_smc_msg_with_param+0x1e8/0x2d0 [amdgpu]
      [  +0.003313]  ? amdgpu_dpm_get_mclk+0x54/0x60 [amdgpu]
      [  +0.002703]  kgd2kfd_device_init.cold+0x39f/0x4ed [amdgpu]
      [  +0.002930]  amdgpu_amdkfd_device_init+0x13d/0x1f0 [amdgpu]
      [  +0.002944]  amdgpu_device_init.cold+0x1464/0x17b4 [amdgpu]
      [  +0.002970]  ? pci_bus_read_config_word+0x43/0x80
      [  +0.002380]  amdgpu_driver_load_kms+0x15/0x100 [amdgpu]
      [  +0.002744]  amdgpu_pci_probe+0x147/0x370 [amdgpu]
      [  +0.002522]  local_pci_probe+0x40/0x80
      [  +0.001896]  work_for_cpu_fn+0x10/0x20
      [  +0.001892]  process_one_work+0x26e/0x5a0
      [  +0.002029]  worker_thread+0x1fd/0x3e0
      [  +0.001890]  ? process_one_work+0x5a0/0x5a0
      [  +0.002115]  kthread+0xea/0x110
      [  +0.001618]  ? kthread_complete_and_exit+0x20/0x20
      [  +0.002422]  ret_from_fork+0x1f/0x30
      [  +0.001808]  </TASK>
      [  +0.001103] irq event stamp: 59837
      [  +0.001718] hardirqs last  enabled at (59849): [<ffffffffb30fab12>] __up_console_sem+0x52/0x60
      [  +0.004414] hardirqs last disabled at (59860): [<ffffffffb30faaf7>] __up_console_sem+0x37/0x60
      [  +0.004414] softirqs last  enabled at (59654): [<ffffffffb307d9c7>] irq_exit_rcu+0xd7/0x130
      [  +0.004205] softirqs last disabled at (59649): [<ffffffffb307d9c7>] irq_exit_rcu+0xd7/0x130
      [  +0.004203] ---[ end trace 0000000000000000 ]---
      
      Fixes: 0f28cca8 ("drm/amdkfd: Extend KFD device topology to surface peer-to-peer links")
      Signed-off-by: default avatarMukul Joshi <mukul.joshi@amd.com>
      Reviewed-by: default avatarFelix Kuehling <Felix.Kuehling@amd.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>
      306888b1
    • Ma Jun's avatar
      drm/plane-helper: Add the missing declaration of drm_atomic_state · c7041ec4
      Ma Jun authored
      
      commit 4e699e34 upstream.
      
      Add the missing declaration of struct drm_atomic_state to fix the
      compile error below:
      
      error: 'struct drm_atomic_state' declared inside parameter
      list will not be visible outside of this definition or declaration [-Werror]
      
      Signed-off-by: default avatarMa Jun <majun@amd.com>
      Reviewed-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
      Signed-off-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
      Fixes: 8401bd36 ("drm/plane-helper: Add a drm_plane_helper_atomic_check() helper")
      Cc: Javier Martinez Canillas <javierm@redhat.com>
      Cc: Thomas Zimmermann <tzimmermann@suse.de>
      Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
      Cc: Maxime Ripard <mripard@kernel.org>
      Cc: David Airlie <airlied@gmail.com>
      Cc: Daniel Vetter <daniel@ffwll.ch>
      Cc: dri-devel@lists.freedesktop.org
      Cc: <stable@vger.kernel.org> # v6.1+
      Link: https://patchwork.freedesktop.org/patch/msgid/20221216030526.1335609-1-majun@amd.com
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c7041ec4
    • Andreas Rammhold's avatar
      of/fdt: run soc memory setup when early_init_dt_scan_memory fails · c4849f18
      Andreas Rammhold authored
      
      commit 2a12187d upstream.
      
      If memory has been found early_init_dt_scan_memory now returns 1. If
      it hasn't found any memory it will return 0, allowing other memory
      setup mechanisms to carry on.
      
      Previously early_init_dt_scan_memory always returned 0 without
      distinguishing between any kind of memory setup being done or not. Any
      code path after the early_init_dt_scan memory call in the ramips
      plat_mem_setup code wouldn't be executed anymore. Making
      early_init_dt_scan_memory the only way to initialize the memory.
      
      Some boards, including my mt7621 based Cudy X6 board, depend on memory
      initialization being done via the soc_info.mem_detect function
      pointer. Those wouldn't be able to obtain memory and panic the kernel
      during early bootup with the message "early_init_dt_alloc_memory_arch:
      Failed to allocate 12416 bytes align=0x40".
      
      Fixes: 1f012283 ("of/fdt: Rework early_init_dt_scan_memory() to call directly")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarAndreas Rammhold <andreas@rammhold.de>
      Link: https://lore.kernel.org/r/20221223112748.2935235-1-andreas@rammhold.de
      
      
      Signed-off-by: default avatarRob Herring <robh@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c4849f18
    • Björn Töpel's avatar
      riscv, kprobes: Stricter c.jr/c.jalr decoding · a33220fa
      Björn Töpel authored
      
      commit b2d473a6 upstream.
      
      In the compressed instruction extension, c.jr, c.jalr, c.mv, and c.add
      is encoded the following way (each instruction is 16b):
      
      ---+-+-----------+-----------+--
      100 0 rs1[4:0]!=0       00000 10 : c.jr
      100 1 rs1[4:0]!=0       00000 10 : c.jalr
      100 0  rd[4:0]!=0 rs2[4:0]!=0 10 : c.mv
      100 1  rd[4:0]!=0 rs2[4:0]!=0 10 : c.add
      
      The following logic is used to decode c.jr and c.jalr:
      
        insn & 0xf007 == 0x8002 => instruction is an c.jr
        insn & 0xf007 == 0x9002 => instruction is an c.jalr
      
      When 0xf007 is used to mask the instruction, c.mv can be incorrectly
      decoded as c.jr, and c.add as c.jalr.
      
      Correct the decoding by changing the mask from 0xf007 to 0xf07f.
      
      Fixes: c22b0bcb ("riscv: Add kprobes supported")
      Signed-off-by: default avatarBjörn Töpel <bjorn@rivosinc.com>
      Reviewed-by: default avatarConor Dooley <conor.dooley@microchip.com>
      Reviewed-by: default avatarGuo Ren <guoren@kernel.org>
      Link: https://lore.kernel.org/r/20230102160748.1307289-1-bjorn@kernel.org
      
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a33220fa
    • Ben Dooks's avatar
      riscv: uaccess: fix type of 0 variable on error in get_user() · 36fd385a
      Ben Dooks authored
      
      commit b9b916ae upstream.
      
      If the get_user(x, ptr) has x as a pointer, then the setting
      of (x) = 0 is going to produce the following sparse warning,
      so fix this by forcing the type of 'x' when access_ok() fails.
      
      fs/aio.c:2073:21: warning: Using plain integer as NULL pointer
      
      Signed-off-by: default avatarBen Dooks <ben-linux@fluff.org>
      Reviewed-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
      Link: https://lore.kernel.org/r/20221229170545.718264-1-ben-linux@fluff.org
      
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      36fd385a
    • Srinivas Pandruvada's avatar
      thermal: int340x: Add missing attribute for data rate base · 7f56c4fa
      Srinivas Pandruvada authored
      
      commit b878d3ba upstream.
      
      Commit 473be511 ("thermal: int340x: processor_thermal: Add RFIM
      driver")' added rfi_restriction_data_rate_base string, mmio details and
      documentation, but missed adding attribute to sysfs.
      
      Add missing sysfs attribute.
      
      Fixes: 473be511 ("thermal: int340x: processor_thermal: Add RFIM driver")
      Cc: 5.11+ <stable@vger.kernel.org> # v5.11+
      Signed-off-by: default avatarSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7f56c4fa
    • Cindy Lu's avatar
      vhost_vdpa: fix the crash in unmap a large memory · 8b258a31
      Cindy Lu authored
      
      commit e794070a upstream.
      
      While testing in vIOMMU, sometimes Guest will unmap very large memory,
      which will cause the crash. To fix this, add a new function
      vhost_vdpa_general_unmap(). This function will only unmap the memory
      that saved in iotlb.
      
      Call Trace:
      [  647.820144] ------------[ cut here ]------------
      [  647.820848] kernel BUG at drivers/iommu/intel/iommu.c:1174!
      [  647.821486] invalid opcode: 0000 [#1] PREEMPT SMP PTI
      [  647.822082] CPU: 10 PID: 1181 Comm: qemu-system-x86 Not tainted 6.0.0-rc1home_lulu_2452_lulu7_vhost+ #62
      [  647.823139] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.15.0-29-g6a62e0cb0dfe-prebuilt.qem4
      [  647.824365] RIP: 0010:domain_unmap+0x48/0x110
      [  647.825424] Code: 48 89 fb 8d 4c f6 1e 39 c1 0f 4f c8 83 e9 0c 83 f9 3f 7f 18 48 89 e8 48 d3 e8 48 85 c0 75 59
      [  647.828064] RSP: 0018:ffffae5340c0bbf0 EFLAGS: 00010202
      [  647.828973] RAX: 0000000000000001 RBX: ffff921793d10540 RCX: 000000000000001b
      [  647.830083] RDX: 00000000080000ff RSI: 0000000000000001 RDI: ffff921793d10540
      [  647.831214] RBP: 0000000007fc0100 R08: ffffae5340c0bcd0 R09: 0000000000000003
      [  647.832388] R10: 0000007fc0100000 R11: 0000000000100000 R12: 00000000080000ff
      [  647.833668] R13: ffffae5340c0bcd0 R14: ffff921793d10590 R15: 0000008000100000
      [  647.834782] FS:  00007f772ec90640(0000) GS:ffff921ce7a80000(0000) knlGS:0000000000000000
      [  647.836004] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [  647.836990] CR2: 00007f02c27a3a20 CR3: 0000000101b0c006 CR4: 0000000000372ee0
      [  647.838107] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      [  647.839283] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      [  647.840666] Call Trace:
      [  647.841437]  <TASK>
      [  647.842107]  intel_iommu_unmap_pages+0x93/0x140
      [  647.843112]  __iommu_unmap+0x91/0x1b0
      [  647.844003]  iommu_unmap+0x6a/0x95
      [  647.844885]  vhost_vdpa_unmap+0x1de/0x1f0 [vhost_vdpa]
      [  647.845985]  vhost_vdpa_process_iotlb_msg+0xf0/0x90b [vhost_vdpa]
      [  647.847235]  ? _raw_spin_unlock+0x15/0x30
      [  647.848181]  ? _copy_from_iter+0x8c/0x580
      [  647.849137]  vhost_chr_write_iter+0xb3/0x430 [vhost]
      [  647.850126]  vfs_write+0x1e4/0x3a0
      [  647.850897]  ksys_write+0x53/0xd0
      [  647.851688]  do_syscall_64+0x3a/0x90
      [  647.852508]  entry_SYSCALL_64_after_hwframe+0x63/0xcd
      [  647.853457] RIP: 0033:0x7f7734ef9f4f
      [  647.854408] Code: 89 54 24 18 48 89 74 24 10 89 7c 24 08 e8 29 76 f8 ff 48 8b 54 24 18 48 8b 74 24 10 41 89 c8
      [  647.857217] RSP: 002b:00007f772ec8f040 EFLAGS: 00000293 ORIG_RAX: 0000000000000001
      [  647.858486] RAX: ffffffffffffffda RBX: 00000000fef00000 RCX: 00007f7734ef9f4f
      [  647.859713] RDX: 0000000000000048 RSI: 00007f772ec8f090 RDI: 0000000000000010
      [  647.860942] RBP: 00007f772ec8f1a0 R08: 0000000000000000 R09: 0000000000000000
      [  647.862206] R10: 0000000000000001 R11: 0000000000000293 R12: 0000000000000010
      [  647.863446] R13: 0000000000000002 R14: 0000000000000000 R15: ffffffff01100000
      [  647.864692]  </TASK>
      [  647.865458] Modules linked in: rpcsec_gss_krb5 auth_rpcgss nfsv4 dns_resolver nfs lockd grace fscache netfs v]
      [  647.874688] ---[ end trace 0000000000000000 ]---
      
      Cc: stable@vger.kernel.org
      Fixes: 4c8cf318 ("vhost: introduce vDPA-based backend")
      Signed-off-by: default avatarCindy Lu <lulu@redhat.com>
      Message-Id: <20221219073331.556140-1-lulu@redhat.com>
      Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8b258a31
    • Jason A. Donenfeld's avatar
      tpm: Allow system suspend to continue when TPM suspend fails · ed2d0e16
      Jason A. Donenfeld authored
      commit 1382999a upstream.
      
      TPM 1 is sometimes broken across system suspends, due to races or
      locking issues or something else that haven't been diagnosed or fixed
      yet, most likely having to do with concurrent reads from the TPM's
      hardware random number generator driver. These issues prevent the system
      from actually suspending, with errors like:
      
        tpm tpm0: A TPM error (28) occurred continue selftest
        ...
        tpm tpm0: A TPM error (28) occurred attempting get random
        ...
        tpm tpm0: Error (28) sending savestate before suspend
        tpm_tis 00:08: PM: __pnp_bus_suspend(): tpm_pm_suspend+0x0/0x80 returns 28
        tpm_tis 00:08: PM: dpm_run_callback(): pnp_bus_suspend+0x0/0x10 returns 28
        tpm_tis 00:08: PM: failed to suspend: error 28
        PM: Some devices failed to suspend, or early wake event detected
      
      This issue was partially fixed by 23393c64 ("char: tpm: Protect
      tpm_pm_suspend with locks"), in a last minute 6.1 commit that Linus took
      directly because the TPM maintainers weren't available. However, it
      seems like this just addresses the most common cases of the bug, rather
      than addressing it entirely. So there are more things to fix still,
      apparently.
      
      In lieu of actually fixing the underlying bug, just allow system suspend
      to continue, so that laptops still go to sleep fine. Later, this can be
      reverted when the real bug is fixed.
      
      Link: https://lore.kernel.org/lkml/7cbe96cf-e0b5-ba63-d1b4-f63d2e826efa@suse.cz/
      
      
      Cc: stable@vger.kernel.org # 6.1+
      Reported-by: default avatarVlastimil Babka <vbabka@suse.cz>
      Suggested-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Acked-by: default avatarLuigi Semenzato <semenzato@chromium.org>
      Cc: Peter Huewe <peterhuewe@gmx.de>
      Cc: Jarkko Sakkinen <jarkko@kernel.org>
      Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
      Cc: Johannes Altmanninger <aclopte@gmail.com>
      Signed-off-by: default avatarJason A. Donenfeld <Jason@zx2c4.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ed2d0e16
Loading