1. 17 Mar, 2023 1 commit
    • Linus Torvalds's avatar
      Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi · 7622976c
      Linus Torvalds authored
      Pull SCSI fixes from James Bottomley:
       "Ten patches, eight in drivers and two in the core, which correct a
        regression from directory removal and add a no VPD size quirk also to
        fix a regression. All pretty small"
      
      * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
        scsi: ufs: mcq: Use active_reqs to check busy in clock scaling
        scsi: core: Fix a procfs host directory removal regression
        scsi: core: Add BLIST_NO_VPD_SIZE for some VDASD
        scsi: mpi3mr: Fix expander node leak in mpi3mr_remove()
        scsi: mpi3mr: Fix memory leaks in mpi3mr_init_ioc()
        scsi: mpi3mr: Fix sas_hba.phy memory leak in mpi3mr_remove()
        scsi: mpi3mr: Fix mpi3mr_hba_port memory leak in mpi3mr_remove()
        scsi: mpi3mr: Fix config page DMA memory leak
        scsi: mpi3mr: Fix throttle_groups memory leak
        scsi: mpt3sas: Fix NULL pointer access in mpt3sas_transport_port_add()
      7622976c
  2. 16 Mar, 2023 2 commits
    • Linus Torvalds's avatar
      Merge tag '6.3-rc2-smb3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6 · 38e04b3e
      Linus Torvalds authored
      Pull cifs client fixes from Steve French:
       "Seven cifs/smb3 client fixes, all also for stable:
      
         - four DFS fixes
      
         - multichannel reconnect fix
      
         - fix smb1 stats for cancel command
      
         - fix for set file size error path"
      
      * tag '6.3-rc2-smb3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6:
        cifs: use DFS root session instead of tcon ses
        cifs: return DFS root session id in DebugData
        cifs: fix use-after-free bug in refresh_cache_worker()
        cifs: set DFS root session in cifs_get_smb_ses()
        cifs: generate signkey for the channel that's reconnecting
        cifs: Fix smb2_set_path_size()
        cifs: Move the in_send statistic to __smb_send_rqst()
      38e04b3e
    • Linus Torvalds's avatar
      Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm · 0ddc84d2
      Linus Torvalds authored
      Pull kvm fixes from Paolo Bonzini:
       "ARM64:
      
         - Address a rather annoying bug w.r.t. guest timer offsetting. The
           synchronization of timer offsets between vCPUs was broken, leading
           to inconsistent timer reads within the VM.
      
        x86:
      
         - New tests for the slow path of the EVTCHNOP_send Xen hypercall
      
         - Add missing nVMX consistency checks for CR0 and CR4
      
         - Fix bug that broke AMD GATag on 512 vCPU machines
      
        Selftests:
      
         - Skip hugetlb tests if huge pages are not available
      
         - Sync KVM exit reasons"
      
      * tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm:
        KVM: selftests: Sync KVM exit reasons in selftests
        KVM: selftests: Add macro to generate KVM exit reason strings
        KVM: selftests: Print expected and actual exit reason in KVM exit reason assert
        KVM: selftests: Make vCPU exit reason test assertion common
        KVM: selftests: Add EVTCHNOP_send slow path test to xen_shinfo_test
        KVM: selftests: Use enum for test numbers in xen_shinfo_test
        KVM: selftests: Add helpers to make Xen-style VMCALL/VMMCALL hypercalls
        KVM: selftests: Move the guts of kvm_hypercall() to a separate macro
        KVM: SVM: WARN if GATag generation drops VM or vCPU ID information
        KVM: SVM: Modify AVIC GATag to support max number of 512 vCPUs
        KVM: SVM: Fix a benign off-by-one bug in AVIC physical table mask
        selftests: KVM: skip hugetlb tests if huge pages are not available
        KVM: VMX: Use tabs instead of spaces for indentation
        KVM: VMX: Fix indentation coding style issue
        KVM: nVMX: remove unnecessary #ifdef
        KVM: nVMX: add missing consistency checks for CR0 and CR4
        KVM: arm64: timers: Convert per-vcpu virtual offset to a global value
      0ddc84d2
  3. 15 Mar, 2023 9 commits
    • Linus Torvalds's avatar
      Merge tag 'linux-kselftest-fixes-6.3-rc3' of... · 9c1bec9c
      Linus Torvalds authored
      Merge tag 'linux-kselftest-fixes-6.3-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest
      
      Pull kselftest fixes from Shuah Khan:
       "A fix to amd-pstate test Makefile and a fix to LLVM build for x86 in
        kselftest common lib.mk"
      
      * tag 'linux-kselftest-fixes-6.3-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest:
        selftests: fix LLVM build for i386 and x86_64
        selftests: amd-pstate: fix TEST_FILES
      9c1bec9c
    • Paulo Alcantara's avatar
      cifs: use DFS root session instead of tcon ses · 6284e46b
      Paulo Alcantara authored
      Use DFS root session whenever possible to get new DFS referrals
      otherwise we might end up with an IPC tcon (tcon->ses->tcon_ipc) that
      doesn't respond to them.  It should be safe accessing
      @ses->dfs_root_ses directly in cifs_inval_name_dfs_link_error() as it
      has same lifetime as of @tcon.
      Signed-off-by: default avatarPaulo Alcantara (SUSE) <pc@manguebit.com>
      Cc: stable@vger.kernel.org # 6.2
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      6284e46b
    • Paulo Alcantara's avatar
      cifs: return DFS root session id in DebugData · f446a630
      Paulo Alcantara authored
      Return the DFS root session id in /proc/fs/cifs/DebugData to make it
      easier to track which IPC tcon was used to get new DFS referrals for a
      specific connection, and aids in debugging.
      
      A simple output of it would be
      
        Sessions:
        1) Address: 192.168.1.13 Uses: 1 Capability: 0x300067   Session Status: 1
        Security type: RawNTLMSSP  SessionId: 0xd80000000009
        User: 0 Cred User: 0
        DFS root session id: 0x128006c000035
      Signed-off-by: default avatarPaulo Alcantara (SUSE) <pc@manguebit.com>
      Cc: stable@vger.kernel.org # 6.2
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      f446a630
    • Linus Torvalds's avatar
      sched_getaffinity: don't assume 'cpumask_size()' is fully initialized · 6015b1ac
      Linus Torvalds authored
      The getaffinity() system call uses 'cpumask_size()' to decide how big
      the CPU mask is - so far so good.  It is indeed the allocation size of a
      cpumask.
      
      But the code also assumes that the whole allocation is initialized
      without actually doing so itself.  That's wrong, because we might have
      fixed-size allocations (making copying and clearing more efficient), but
      not all of it is then necessarily used if 'nr_cpu_ids' is smaller.
      
      Having checked other users of 'cpumask_size()', they all seem to be ok,
      either using it purely for the allocation size, or explicitly zeroing
      the cpumask before using the size in bytes to copy it.
      
      See for example the ublk_ctrl_get_queue_affinity() function that uses
      the proper 'zalloc_cpumask_var()' to make sure that the whole mask is
      cleared, whether the storage is on the stack or if it was an external
      allocation.
      
      Fix this by just zeroing the allocation before using it.  Do the same
      for the compat version of sched_getaffinity(), which had the same logic.
      
      Also, for consistency, make sched_getaffinity() use 'cpumask_bits()' to
      access the bits.  For a cpumask_var_t, it ends up being a pointer to the
      same data either way, but it's just a good idea to treat it like you
      would a 'cpumask_t'.  The compat case already did that.
      Reported-by: default avatarRyan Roberts <ryan.roberts@arm.com>
      Link: https://lore.kernel.org/lkml/7d026744-6bd6-6827-0471-b5e8eae0be3f@arm.com/
      Cc: Yury Norov <yury.norov@gmail.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      6015b1ac
    • Paulo Alcantara's avatar
      cifs: fix use-after-free bug in refresh_cache_worker() · 396935de
      Paulo Alcantara authored
      The UAF bug occurred because we were putting DFS root sessions in
      cifs_umount() while DFS cache refresher was being executed.
      
      Make DFS root sessions have same lifetime as DFS tcons so we can avoid
      the use-after-free bug is DFS cache refresher and other places that
      require IPCs to get new DFS referrals on.  Also, get rid of mount
      group handling in DFS cache as we no longer need it.
      
      This fixes below use-after-free bug catched by KASAN
      
      [ 379.946955] BUG: KASAN: use-after-free in __refresh_tcon.isra.0+0x10b/0xc10 [cifs]
      [ 379.947642] Read of size 8 at addr ffff888018f57030 by task kworker/u4:3/56
      [ 379.948096]
      [ 379.948208] CPU: 0 PID: 56 Comm: kworker/u4:3 Not tainted 6.2.0-rc7-lku #23
      [ 379.948661] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS
      rel-1.16.0-0-gd239552-rebuilt.opensuse.org 04/01/2014
      [ 379.949368] Workqueue: cifs-dfscache refresh_cache_worker [cifs]
      [ 379.949942] Call Trace:
      [ 379.950113] <TASK>
      [ 379.950260] dump_stack_lvl+0x50/0x67
      [ 379.950510] print_report+0x16a/0x48e
      [ 379.950759] ? __virt_addr_valid+0xd8/0x160
      [ 379.951040] ? __phys_addr+0x41/0x80
      [ 379.951285] kasan_report+0xdb/0x110
      [ 379.951533] ? __refresh_tcon.isra.0+0x10b/0xc10 [cifs]
      [ 379.952056] ? __refresh_tcon.isra.0+0x10b/0xc10 [cifs]
      [ 379.952585] __refresh_tcon.isra.0+0x10b/0xc10 [cifs]
      [ 379.953096] ? __pfx___refresh_tcon.isra.0+0x10/0x10 [cifs]
      [ 379.953637] ? __pfx___mutex_lock+0x10/0x10
      [ 379.953915] ? lock_release+0xb6/0x720
      [ 379.954167] ? __pfx_lock_acquire+0x10/0x10
      [ 379.954443] ? refresh_cache_worker+0x34e/0x6d0 [cifs]
      [ 379.954960] ? __pfx_wb_workfn+0x10/0x10
      [ 379.955239] refresh_cache_worker+0x4ad/0x6d0 [cifs]
      [ 379.955755] ? __pfx_refresh_cache_worker+0x10/0x10 [cifs]
      [ 379.956323] ? __pfx_lock_acquired+0x10/0x10
      [ 379.956615] ? read_word_at_a_time+0xe/0x20
      [ 379.956898] ? lockdep_hardirqs_on_prepare+0x12/0x220
      [ 379.957235] process_one_work+0x535/0x990
      [ 379.957509] ? __pfx_process_one_work+0x10/0x10
      [ 379.957812] ? lock_acquired+0xb7/0x5f0
      [ 379.958069] ? __list_add_valid+0x37/0xd0
      [ 379.958341] ? __list_add_valid+0x37/0xd0
      [ 379.958611] worker_thread+0x8e/0x630
      [ 379.958861] ? __pfx_worker_thread+0x10/0x10
      [ 379.959148] kthread+0x17d/0x1b0
      [ 379.959369] ? __pfx_kthread+0x10/0x10
      [ 379.959630] ret_from_fork+0x2c/0x50
      [ 379.959879] </TASK>
      Signed-off-by: default avatarPaulo Alcantara (SUSE) <pc@manguebit.com>
      Cc: stable@vger.kernel.org # 6.2
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      396935de
    • Paulo Alcantara's avatar
      cifs: set DFS root session in cifs_get_smb_ses() · b56bce50
      Paulo Alcantara authored
      Set the DFS root session pointer earlier when creating a new SMB
      session to prevent racing with smb2_reconnect(), cifs_reconnect_tcon()
      and DFS cache refresher.
      Signed-off-by: default avatarPaulo Alcantara (SUSE) <pc@manguebit.com>
      Cc: stable@vger.kernel.org # 6.2
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      b56bce50
    • Linus Torvalds's avatar
      Merge tag 'mm-hotfixes-stable-2023-03-14-16-51' of... · 26e2878b
      Linus Torvalds authored
      Merge tag 'mm-hotfixes-stable-2023-03-14-16-51' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
      
      Pull misc fixes from Andrew Morton:
       "Eleven hotfixes.
      
        Four of these are cc:stable and the remainder address post-6.2 issues
        or aren't considered suitable for backporting.
      
        Seven of these fixes are for MM"
      
      * tag 'mm-hotfixes-stable-2023-03-14-16-51' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm:
        mm/damon/paddr: fix folio_nr_pages() after folio_put() in damon_pa_mark_accessed_or_deactivate()
        mm/damon/paddr: fix folio_size() call after folio_put() in damon_pa_young()
        ocfs2: fix data corruption after failed write
        migrate_pages: try migrate in batch asynchronously firstly
        migrate_pages: move split folios processing out of migrate_pages_batch()
        migrate_pages: fix deadlock in batched migration
        .mailmap: add Alexandre Ghiti personal email address
        mailmap: correct Dikshita Agarwal's Qualcomm email address
        mailmap: updates for Jarkko Sakkinen
        mm/userfaultfd: propagate uffd-wp bit when PTE-mapping the huge zeropage
        mm: teach mincore_hugetlb about pte markers
      26e2878b
    • Linus Torvalds's avatar
      Merge tag 'trace-v6.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace · 29db00c2
      Linus Torvalds authored
      Pull tracing fixes from Steven Rostedt:
      
       - Do not allow histogram values to have modifies. They can cause a NULL
         pointer dereference if they do.
      
       - Warn if hist_field_name() is passed a NULL. Prevent the NULL pointer
         dereference mentioned above.
      
       - Fix invalid address look up race in lookup_rec()
      
       - Define ftrace_stub_graph conditionally to prevent linker errors
      
       - Always check if RCU is watching at all tracepoint locations
      
      * tag 'trace-v6.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace:
        tracing: Make tracepoint lockdep check actually test something
        ftrace,kcfi: Define ftrace_stub_graph conditionally
        ftrace: Fix invalid address access in lookup_rec() when index is 0
        tracing: Check field value in hist_field_name()
        tracing: Do not let histogram values have some modifiers
      29db00c2
    • Linus Torvalds's avatar
      Merge tag 'zstd-linus-v6.3-rc3' of https://github.com/terrelln/linux · ed38ff16
      Linus Torvalds authored
      Pull zstd fixes from Nick Terrell:
       "A small number of fixes for zstd-v1.5.2.
      
        I'm not pulling in zstd-v1.5.4 from upstream this release because it
        didn't have any time to bake in linux-next, but I'm aiming for the
        next update in v6.4"
      
      * tag 'zstd-linus-v6.3-rc3' of https://github.com/terrelln/linux:
        zstd: Fix definition of assert()
        lib: zstd: Backport fix for in-place decompression
        lib: zstd: Fix -Wstringop-overflow warning
      ed38ff16
  4. 14 Mar, 2023 24 commits
  5. 13 Mar, 2023 4 commits
    • Linus Torvalds's avatar
      Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost · fc89d7fb
      Linus Torvalds authored
      Pull virtio fixes from Michael Tsirkin:
       "Some virtio / vhost / vdpa fixes accumulated so far"
      
      * tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost:
        tools/virtio: Ignore virtio-trace/trace-agent
        vdpa_sim: set last_used_idx as last_avail_idx in vdpasim_queue_ready
        vhost-vdpa: free iommu domain after last use during cleanup
        vdpa/mlx5: should not activate virtq object when suspended
        vp_vdpa: fix the crash in hot unplug with vp_vdpa
      fc89d7fb
    • Rong Tao's avatar
      tools/virtio: Ignore virtio-trace/trace-agent · ae43c20d
      Rong Tao authored
      since commit 108fc825("tools: Add guest trace agent as a user tool")
      introduce virtio-trace/trace-agent, it should be ignored in the git tree.
      Signed-off-by: default avatarRong Tao <rongtao@cestc.cn>
      Message-Id: <tencent_52B2BC2F47540A5FEB46E710BD0C8485B409@qq.com>
      Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      ae43c20d
    • Eugenio Pérez's avatar
      vdpa_sim: set last_used_idx as last_avail_idx in vdpasim_queue_ready · b4cca6d4
      Eugenio Pérez authored
      Starting from an used_idx different than 0 is needed in use cases like
      virtual machine migration.  Not doing so and letting the caller set an
      avail idx different than 0 causes destination device to try to use old
      buffers that source driver already recover and are not available
      anymore.
      
      Since vdpa_sim does not support receive inflight descriptors as a
      destination of a migration, let's set both avail_idx and used_idx the
      same at vq start.  This is how vhost-user works in a
      VHOST_SET_VRING_BASE call.
      
      Although the simple fix is to set last_used_idx at vdpasim_set_vq_state,
      it would be reset at vdpasim_queue_ready.  The last_avail_idx case is
      fixed with commit 0e84f918 ("vdpa_sim: not reset state in
      vdpasim_queue_ready").  Since the only option is to make it equal to
      last_avail_idx, adding the only change needed here.
      
      This was discovered and tested live migrating the vdpa_sim_net device.
      
      Fixes: 2c53d0f6 ("vdpasim: vDPA device simulator")
      Reviewed-by: default avatarStefano Garzarella <sgarzare@redhat.com>
      Signed-off-by: default avatarEugenio Pérez <eperezma@redhat.com>
      Message-Id: <20230302181857.925374-1-eperezma@redhat.com>
      Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      b4cca6d4
    • Gautam Dawar's avatar
      vhost-vdpa: free iommu domain after last use during cleanup · 5a522150
      Gautam Dawar authored
      Currently vhost_vdpa_cleanup() unmaps the DMA mappings by calling
      `iommu_unmap(v->domain, map->start, map->size);`
      from vhost_vdpa_general_unmap() when the parent vDPA driver doesn't
      provide DMA config operations.
      
      However, the IOMMU domain referred to by `v->domain` is freed in
      vhost_vdpa_free_domain() before vhost_vdpa_cleanup() in
      vhost_vdpa_release() which results in NULL pointer de-reference.
      Accordingly, moving the call to vhost_vdpa_free_domain() in
      vhost_vdpa_cleanup() would makes sense. This will also help
      detaching the dma device in error handling of vhost_vdpa_alloc_domain().
      
      This issue was observed on terminating QEMU with SIGQUIT.
      
      Fixes: 037d4305 ("vhost-vdpa: call vhost_vdpa_cleanup during the release")
      Signed-off-by: default avatarGautam Dawar <gautam.dawar@amd.com>
      Message-Id: <20230301163203.29883-1-gautam.dawar@amd.com>
      Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Acked-by: default avatarJason Wang <jasowang@redhat.com>
      Reviewed-by: default avatarStefano Garzarella <sgarzare@redhat.com>
      5a522150