Skip to content
  1. Apr 06, 2023
    • Damien Le Moal's avatar
      zonefs: Always invalidate last cached page on append write · d7c67be7
      Damien Le Moal authored
      commit c1976bd8
      
       upstream.
      
      When a direct append write is executed, the append offset may correspond
      to the last page of a sequential file inode which might have been cached
      already by buffered reads, page faults with mmap-read or non-direct
      readahead. To ensure that the on-disk and cached data is consistant for
      such last cached page, make sure to always invalidate it in
      zonefs_file_dio_append(). If the invalidation fails, return -EBUSY to
      userspace to differentiate from IO errors.
      
      This invalidation will always be a no-op when the FS block size (device
      zone write granularity) is equal to the page size (e.g. 4K).
      
      Reported-by: default avatarHans Holmberg <Hans.Holmberg@wdc.com>
      Fixes: 02ef12a6
      
       ("zonefs: use REQ_OP_ZONE_APPEND for sync DIO")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarDamien Le Moal <damien.lemoal@opensource.wdc.com>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Reviewed-by: default avatarJohannes Thumshirn <johannes.thumshirn@wdc.com>
      Tested-by: default avatarHans Holmberg <hans.holmberg@wdc.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d7c67be7
    • Ronak Doshi's avatar
      vmxnet3: use gro callback when UPT is enabled · 4d35d375
      Ronak Doshi authored
      commit 3bced313 upstream.
      
      Currently, vmxnet3 uses GRO callback only if LRO is disabled. However,
      on smartNic based setups where UPT is supported, LRO can be enabled
      from guest VM but UPT devicve does not support LRO as of now. In such
      cases, there can be performance degradation as GRO is not being done.
      
      This patch fixes this issue by calling GRO API when UPT is enabled. We
      use updateRxProd to determine if UPT mode is active or not.
      
      To clarify few things discussed over the thread:
      The patch is not neglecting any feature bits nor disabling GRO. It uses
      GRO callback when UPT is active as LRO is not available in UPT.
      GRO callback cannot be used as default for all cases as it degrades
      performance for non-UPT cases or for cases when LRO is already done in
      ESXi.
      
      Cc: stable@vger.kernel.org
      Fixes: 6f91f4ba
      
       ("vmxnet3: add support for capability registers")
      Signed-off-by: default avatarRonak Doshi <doshir@vmware.com>
      Reviewed-by: default avatarSimon Horman <simon.horman@corigine.com>
      Link: https://lore.kernel.org/r/20230323200721.27622-1-doshir@vmware.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4d35d375
    • Pavel Begunkov's avatar
      io_uring: fix poll/netmsg alloc caches · d67b3cda
      Pavel Begunkov authored
      commit fd30d1cd upstream.
      
      We increase cache->nr_cached when we free into the cache but don't
      decrease when we take from it, so in some time we'll get an empty
      cache with cache->nr_cached larger than IO_ALLOC_CACHE_MAX, that fails
      io_alloc_cache_put() and effectively disables caching.
      
      Fixes: 9b797a37
      
       ("io_uring: add abstraction around apoll cache")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarPavel Begunkov <asml.silence@gmail.com>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d67b3cda
    • Pavel Begunkov's avatar
      io_uring/rsrc: fix rogue rsrc node grabbing · ef329fa7
      Pavel Begunkov authored
      commit 4ff0b50d upstream.
      
      We should not be looking at ctx->rsrc_node and anyhow modifying the node
      without holding uring_lock, grabbing references in such a way is not
      safe either.
      
      Cc: stable@vger.kernel.org
      Fixes: 5106dd6e
      
       ("io_uring: propagate issue_flags state down to file assignment")
      Signed-off-by: default avatarPavel Begunkov <asml.silence@gmail.com>
      Link: https://lore.kernel.org/r/1202ede2d7bb90136e3482b2b84aad9ed483e5d6.1680098433.git.asml.silence@gmail.com
      
      
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ef329fa7
    • Jens Axboe's avatar
      io_uring/poll: clear single/double poll flags on poll arming · 3eb2138d
      Jens Axboe authored
      commit 005308f7 upstream.
      
      Unless we have at least one entry queued, then don't call into
      io_poll_remove_entries(). Normally this isn't possible, but if we
      retry poll then we can have ->nr_entries cleared again as we're
      setting it up. If this happens for a poll retry, then we'll still have
      at least REQ_F_SINGLE_POLL set. io_poll_remove_entries() then thinks
      it has entries to remove.
      
      Clear REQ_F_SINGLE_POLL and REQ_F_DOUBLE_POLL unconditionally when
      arming a poll request.
      
      Fixes: c16bda37
      
       ("io_uring/poll: allow some retries for poll triggering spuriously")
      Cc: stable@vger.kernel.org
      Reported-by: default avatarPengfei Xu <pengfei.xu@intel.com>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3eb2138d
    • Jens Axboe's avatar
      block/io_uring: pass in issue_flags for uring_cmd task_work handling · e5da1182
      Jens Axboe authored
      commit 9d2789ac upstream.
      
      io_uring_cmd_done() currently assumes that the uring_lock is held
      when invoked, and while it generally is, this is not guaranteed.
      Pass in the issue_flags associated with it, so that we have
      IO_URING_F_UNLOCKED available to be able to lock the CQ ring
      appropriately when completing events.
      
      Cc: stable@vger.kernel.org
      Fixes: ee692a21
      
       ("fs,io_uring: add infrastructure for uring-cmd")
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e5da1182
    • Damien Le Moal's avatar
      zonefs: Do not propagate iomap_dio_rw() ENOTBLK error to user space · 4a8f1f51
      Damien Le Moal authored
      commit 77af13ba
      
       upstream.
      
      The call to invalidate_inode_pages2_range() in __iomap_dio_rw() may
      fail, in which case -ENOTBLK is returned and this error code is
      propagated back to user space trhough iomap_dio_rw() ->
      zonefs_file_dio_write() return chain. This error code is fairly obscure
      and may confuse the user. Avoid this and be consistent with the behavior
      of zonefs_file_dio_append() for similar invalidate_inode_pages2_range()
      errors by returning -EBUSY to user space when iomap_dio_rw() returns
      -ENOTBLK.
      
      Suggested-by: default avatarChristoph Hellwig <hch@infradead.org>
      Fixes: 8dcc1a9d
      
       ("fs: New zonefs file system")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarDamien Le Moal <damien.lemoal@opensource.wdc.com>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Reviewed-by: default avatarJohannes Thumshirn <johannes.thumshirn@wdc.com>
      Tested-by: default avatarHans Holmberg <hans.holmberg@wdc.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4a8f1f51
    • Anand Jain's avatar
      btrfs: scan device in non-exclusive mode · 8a6539ea
      Anand Jain authored
      commit 50d281fc
      
       upstream.
      
      This fixes mkfs/mount/check failures due to race with systemd-udevd
      scan.
      
      During the device scan initiated by systemd-udevd, other user space
      EXCL operations such as mkfs, mount, or check may get blocked and result
      in a "Device or resource busy" error. This is because the device
      scan process opens the device with the EXCL flag in the kernel.
      
      Two reports were received:
      
       - btrfs/179 test case, where the fsck command failed with the -EBUSY
         error
      
       - LTP pwritev03 test case, where mkfs.vfs failed with
         the -EBUSY error, when mkfs.vfs tried to overwrite old btrfs filesystem
         on the device.
      
      In both cases, fsck and mkfs (respectively) were racing with a
      systemd-udevd device scan, and systemd-udevd won, resulting in the
      -EBUSY error for fsck and mkfs.
      
      Reproducing the problem has been difficult because there is a very
      small window during which these userspace threads can race to
      acquire the exclusive device open. Even on the system where the problem
      was observed, the problem occurrences were anywhere between 10 to 400
      iterations and chances of reproducing decreases with debug printk()s.
      
      However, an exclusive device open is unnecessary for the scan process,
      as there are no write operations on the device during scan. Furthermore,
      during the mount process, the superblock is re-read in the below
      function call chain:
      
        btrfs_mount_root
         btrfs_open_devices
          open_fs_devices
           btrfs_open_one_device
             btrfs_get_bdev_and_sb
      
      So, to fix this issue, removes the FMODE_EXCL flag from the scan
      operation, and add a comment.
      
      The case where mkfs may still write to the device and a scan is running,
      the btrfs signature is not written at that time so scan will not
      recognize such device.
      
      Reported-by: default avatarSherry Yang <sherry.yang@oracle.com>
      Reported-by: default avatarkernel test robot <oliver.sang@intel.com>
      Link: https://lore.kernel.org/oe-lkp/202303170839.fdf23068-oliver.sang@intel.com
      
      
      CC: stable@vger.kernel.org # 5.4+
      Signed-off-by: default avatarAnand Jain <anand.jain@oracle.com>
      Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8a6539ea
    • Filipe Manana's avatar
      btrfs: fix race between quota disable and quota assign ioctls · a38ff202
      Filipe Manana authored
      commit 2f1a6be1
      
       upstream.
      
      The quota assign ioctl can currently run in parallel with a quota disable
      ioctl call. The assign ioctl uses the quota root, while the disable ioctl
      frees that root, and therefore we can have a use-after-free triggered in
      the assign ioctl, leading to a trace like the following when KASAN is
      enabled:
      
        [672.723][T736] BUG: KASAN: slab-use-after-free in btrfs_search_slot+0x2962/0x2db0
        [672.723][T736] Read of size 8 at addr ffff888022ec0208 by task btrfs_search_sl/27736
        [672.724][T736]
        [672.725][T736] CPU: 1 PID: 27736 Comm: btrfs_search_sl Not tainted 6.3.0-rc3 #37
        [672.723][T736] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014
        [672.727][T736] Call Trace:
        [672.728][T736]  <TASK>
        [672.728][T736]  dump_stack_lvl+0xd9/0x150
        [672.725][T736]  print_report+0xc1/0x5e0
        [672.720][T736]  ? __virt_addr_valid+0x61/0x2e0
        [672.727][T736]  ? __phys_addr+0xc9/0x150
        [672.725][T736]  ? btrfs_search_slot+0x2962/0x2db0
        [672.722][T736]  kasan_report+0xc0/0xf0
        [672.729][T736]  ? btrfs_search_slot+0x2962/0x2db0
        [672.724][T736]  btrfs_search_slot+0x2962/0x2db0
        [672.723][T736]  ? fs_reclaim_acquire+0xba/0x160
        [672.722][T736]  ? split_leaf+0x13d0/0x13d0
        [672.726][T736]  ? rcu_is_watching+0x12/0xb0
        [672.723][T736]  ? kmem_cache_alloc+0x338/0x3c0
        [672.722][T736]  update_qgroup_status_item+0xf7/0x320
        [672.724][T736]  ? add_qgroup_rb+0x3d0/0x3d0
        [672.739][T736]  ? do_raw_spin_lock+0x12d/0x2b0
        [672.730][T736]  ? spin_bug+0x1d0/0x1d0
        [672.737][T736]  btrfs_run_qgroups+0x5de/0x840
        [672.730][T736]  ? btrfs_qgroup_rescan_worker+0xa70/0xa70
        [672.738][T736]  ? __del_qgroup_relation+0x4ba/0xe00
        [672.738][T736]  btrfs_ioctl+0x3d58/0x5d80
        [672.735][T736]  ? tomoyo_path_number_perm+0x16a/0x550
        [672.737][T736]  ? tomoyo_execute_permission+0x4a0/0x4a0
        [672.731][T736]  ? btrfs_ioctl_get_supported_features+0x50/0x50
        [672.737][T736]  ? __sanitizer_cov_trace_switch+0x54/0x90
        [672.734][T736]  ? do_vfs_ioctl+0x132/0x1660
        [672.730][T736]  ? vfs_fileattr_set+0xc40/0xc40
        [672.730][T736]  ? _raw_spin_unlock_irq+0x2e/0x50
        [672.732][T736]  ? sigprocmask+0xf2/0x340
        [672.737][T736]  ? __fget_files+0x26a/0x480
        [672.732][T736]  ? bpf_lsm_file_ioctl+0x9/0x10
        [672.738][T736]  ? btrfs_ioctl_get_supported_features+0x50/0x50
        [672.736][T736]  __x64_sys_ioctl+0x198/0x210
        [672.736][T736]  do_syscall_64+0x39/0xb0
        [672.731][T736]  entry_SYSCALL_64_after_hwframe+0x63/0xcd
        [672.739][T736] RIP: 0033:0x4556ad
        [672.742][T736]  </TASK>
        [672.743][T736]
        [672.748][T736] Allocated by task 27677:
        [672.743][T736]  kasan_save_stack+0x22/0x40
        [672.741][T736]  kasan_set_track+0x25/0x30
        [672.741][T736]  __kasan_kmalloc+0xa4/0xb0
        [672.749][T736]  btrfs_alloc_root+0x48/0x90
        [672.746][T736]  btrfs_create_tree+0x146/0xa20
        [672.744][T736]  btrfs_quota_enable+0x461/0x1d20
        [672.743][T736]  btrfs_ioctl+0x4a1c/0x5d80
        [672.747][T736]  __x64_sys_ioctl+0x198/0x210
        [672.749][T736]  do_syscall_64+0x39/0xb0
        [672.744][T736]  entry_SYSCALL_64_after_hwframe+0x63/0xcd
        [672.756][T736]
        [672.757][T736] Freed by task 27677:
        [672.759][T736]  kasan_save_stack+0x22/0x40
        [672.759][T736]  kasan_set_track+0x25/0x30
        [672.756][T736]  kasan_save_free_info+0x2e/0x50
        [672.751][T736]  ____kasan_slab_free+0x162/0x1c0
        [672.758][T736]  slab_free_freelist_hook+0x89/0x1c0
        [672.752][T736]  __kmem_cache_free+0xaf/0x2e0
        [672.752][T736]  btrfs_put_root+0x1ff/0x2b0
        [672.759][T736]  btrfs_quota_disable+0x80a/0xbc0
        [672.752][T736]  btrfs_ioctl+0x3e5f/0x5d80
        [672.756][T736]  __x64_sys_ioctl+0x198/0x210
        [672.753][T736]  do_syscall_64+0x39/0xb0
        [672.765][T736]  entry_SYSCALL_64_after_hwframe+0x63/0xcd
        [672.769][T736]
        [672.768][T736] The buggy address belongs to the object at ffff888022ec0000
        [672.768][T736]  which belongs to the cache kmalloc-4k of size 4096
        [672.769][T736] The buggy address is located 520 bytes inside of
        [672.769][T736]  freed 4096-byte region [ffff888022ec0000, ffff888022ec1000)
        [672.760][T736]
        [672.764][T736] The buggy address belongs to the physical page:
        [672.761][T736] page:ffffea00008bb000 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x22ec0
        [672.766][T736] head:ffffea00008bb000 order:3 entire_mapcount:0 nr_pages_mapped:0 pincount:0
        [672.779][T736] flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
        [672.770][T736] raw: 00fff00000010200 ffff888012842140 ffffea000054ba00 dead000000000002
        [672.770][T736] raw: 0000000000000000 0000000000040004 00000001ffffffff 0000000000000000
        [672.771][T736] page dumped because: kasan: bad access detected
        [672.778][T736] page_owner tracks the page as allocated
        [672.777][T736] page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd2040(__GFP_IO|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 88
        [672.779][T736]  get_page_from_freelist+0x119c/0x2d50
        [672.779][T736]  __alloc_pages+0x1cb/0x4a0
        [672.776][T736]  alloc_pages+0x1aa/0x270
        [672.773][T736]  allocate_slab+0x260/0x390
        [672.771][T736]  ___slab_alloc+0xa9a/0x13e0
        [672.778][T736]  __slab_alloc.constprop.0+0x56/0xb0
        [672.771][T736]  __kmem_cache_alloc_node+0x136/0x320
        [672.789][T736]  __kmalloc+0x4e/0x1a0
        [672.783][T736]  tomoyo_realpath_from_path+0xc3/0x600
        [672.781][T736]  tomoyo_path_perm+0x22f/0x420
        [672.782][T736]  tomoyo_path_unlink+0x92/0xd0
        [672.780][T736]  security_path_unlink+0xdb/0x150
        [672.788][T736]  do_unlinkat+0x377/0x680
        [672.788][T736]  __x64_sys_unlink+0xca/0x110
        [672.789][T736]  do_syscall_64+0x39/0xb0
        [672.783][T736]  entry_SYSCALL_64_after_hwframe+0x63/0xcd
        [672.784][T736] page last free stack trace:
        [672.787][T736]  free_pcp_prepare+0x4e5/0x920
        [672.787][T736]  free_unref_page+0x1d/0x4e0
        [672.784][T736]  __unfreeze_partials+0x17c/0x1a0
        [672.797][T736]  qlist_free_all+0x6a/0x180
        [672.796][T736]  kasan_quarantine_reduce+0x189/0x1d0
        [672.797][T736]  __kasan_slab_alloc+0x64/0x90
        [672.793][T736]  kmem_cache_alloc+0x17c/0x3c0
        [672.799][T736]  getname_flags.part.0+0x50/0x4e0
        [672.799][T736]  getname_flags+0x9e/0xe0
        [672.792][T736]  vfs_fstatat+0x77/0xb0
        [672.791][T736]  __do_sys_newlstat+0x84/0x100
        [672.798][T736]  do_syscall_64+0x39/0xb0
        [672.796][T736]  entry_SYSCALL_64_after_hwframe+0x63/0xcd
        [672.790][T736]
        [672.791][T736] Memory state around the buggy address:
        [672.799][T736]  ffff888022ec0100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
        [672.805][T736]  ffff888022ec0180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
        [672.802][T736] >ffff888022ec0200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
        [672.809][T736]                       ^
        [672.809][T736]  ffff888022ec0280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
        [672.809][T736]  ffff888022ec0300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
      
      Fix this by having the qgroup assign ioctl take the qgroup ioctl mutex
      before calling btrfs_run_qgroups(), which is what all qgroup ioctls should
      call.
      
      Reported-by: default avatarbutt3rflyh4ck <butterflyhuangxx@gmail.com>
      Link: https://lore.kernel.org/linux-btrfs/CAFcO6XN3VD8ogmHwqRk4kbiwtpUSNySu2VAxN8waEPciCHJvMA@mail.gmail.com/
      
      
      CC: stable@vger.kernel.org # 5.10+
      Reviewed-by: default avatarQu Wenruo <wqu@suse.com>
      Signed-off-by: default avatarFilipe Manana <fdmanana@suse.com>
      Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a38ff202
    • Filipe Manana's avatar
      btrfs: fix deadlock when aborting transaction during relocation with scrub · 6134a4bb
      Filipe Manana authored
      commit 2d82a40a upstream.
      
      Before relocating a block group we pause scrub, then do the relocation and
      then unpause scrub. The relocation process requires starting and committing
      a transaction, and if we have a failure in the critical section of the
      transaction commit path (transaction state >= TRANS_STATE_COMMIT_START),
      we will deadlock if there is a paused scrub.
      
      That results in stack traces like the following:
      
        [42.479] BTRFS info (device sdc): relocating block group 53876686848 flags metadata|raid6
        [42.936] BTRFS warning (device sdc): Skipping commit of aborted transaction.
        [42.936] ------------[ cut here ]------------
        [42.936] BTRFS: Transaction aborted (error -28)
        [42.936] WARNING: CPU: 11 PID: 346822 at fs/btrfs/transaction.c:1977 btrfs_commit_transaction+0xcc8/0xeb0 [btrfs]
        [42.936] Modules linked in: dm_flakey dm_mod loop btrfs (...)
        [42.936] CPU: 11 PID: 346822 Comm: btrfs Tainted: G        W          6.3.0-rc2-btrfs-next-127+ #1
        [42.936] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.14.0-0-g155821a1990b-prebuilt.qemu.org 04/01/2014
        [42.936] RIP: 0010:btrfs_commit_transaction+0xcc8/0xeb0 [btrfs]
        [42.936] Code: ff ff 45 8b (...)
        [42.936] RSP: 0018:ffffb58649633b48 EFLAGS: 00010282
        [42.936] RAX: 0000000000000000 RBX: ffff8be6ef4d5bd8 RCX: 0000000000000000
        [42.936] RDX: 0000000000000002 RSI: ffffffffb35e7782 RDI: 00000000ffffffff
        [42.936] RBP: ffff8be6ef4d5c98 R08: 0000000000000000 R09: ffffb586496339e8
        [42.936] R10: 0000000000000001 R11: 0000000000000001 R12: ffff8be6d38c7c00
        [42.936] R13: 00000000ffffffe4 R14: ffff8be6c268c000 R15: ffff8be6ef4d5cf0
        [42.936] FS:  00007f381a82b340(0000) GS:ffff8beddfcc0000(0000) knlGS:0000000000000000
        [42.936] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
        [42.936] CR2: 00007f1e35fb7638 CR3: 0000000117680006 CR4: 0000000000370ee0
        [42.936] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
        [42.936] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
        [42.936] Call Trace:
        [42.936]  <TASK>
        [42.936]  ? start_transaction+0xcb/0x610 [btrfs]
        [42.936]  prepare_to_relocate+0x111/0x1a0 [btrfs]
        [42.936]  relocate_block_group+0x57/0x5d0 [btrfs]
        [42.936]  ? btrfs_wait_nocow_writers+0x25/0xb0 [btrfs]
        [42.936]  btrfs_relocate_block_group+0x248/0x3c0 [btrfs]
        [42.936]  ? __pfx_autoremove_wake_function+0x10/0x10
        [42.936]  btrfs_relocate_chunk+0x3b/0x150 [btrfs]
        [42.936]  btrfs_balance+0x8ff/0x11d0 [btrfs]
        [42.936]  ? __kmem_cache_alloc_node+0x14a/0x410
        [42.936]  btrfs_ioctl+0x2334/0x32c0 [btrfs]
        [42.937]  ? mod_objcg_state+0xd2/0x360
        [42.937]  ? refill_obj_stock+0xb0/0x160
        [42.937]  ? seq_release+0x25/0x30
        [42.937]  ? __rseq_handle_notify_resume+0x3b5/0x4b0
        [42.937]  ? percpu_counter_add_batch+0x2e/0xa0
        [42.937]  ? __x64_sys_ioctl+0x88/0xc0
        [42.937]  __x64_sys_ioctl+0x88/0xc0
        [42.937]  do_syscall_64+0x38/0x90
        [42.937]  entry_SYSCALL_64_after_hwframe+0x72/0xdc
        [42.937] RIP: 0033:0x7f381a6ffe9b
        [42.937] Code: 00 48 89 44 24 (...)
        [42.937] RSP: 002b:00007ffd45ecf060 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
        [42.937] RAX: ffffffffffffffda RBX: 0000000000000001 RCX: 00007f381a6ffe9b
        [42.937] RDX: 00007ffd45ecf150 RSI: 00000000c4009420 RDI: 0000000000000003
        [42.937] RBP: 0000000000000003 R08: 0000000000000013 R09: 0000000000000000
        [42.937] R10: 00007f381a60c878 R11: 0000000000000246 R12: 00007ffd45ed0423
        [42.937] R13: 00007ffd45ecf150 R14: 0000000000000000 R15: 00007ffd45ecf148
        [42.937]  </TASK>
        [42.937] ---[ end trace 0000000000000000 ]---
        [42.937] BTRFS: error (device sdc: state A) in cleanup_transaction:1977: errno=-28 No space left
        [59.196] INFO: task btrfs:346772 blocked for more than 120 seconds.
        [59.196]       Tainted: G        W          6.3.0-rc2-btrfs-next-127+ #1
        [59.196] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
        [59.196] task:btrfs           state:D stack:0     pid:346772 ppid:1      flags:0x00004002
        [59.196] Call Trace:
        [59.196]  <TASK>
        [59.196]  __schedule+0x392/0xa70
        [59.196]  ? __pv_queued_spin_lock_slowpath+0x165/0x370
        [59.196]  schedule+0x5d/0xd0
        [59.196]  __scrub_blocked_if_needed+0x74/0xc0 [btrfs]
        [59.197]  ? __pfx_autoremove_wake_function+0x10/0x10
        [59.197]  scrub_pause_off+0x21/0x50 [btrfs]
        [59.197]  scrub_simple_mirror+0x1c7/0x950 [btrfs]
        [59.197]  ? scrub_parity_put+0x1a5/0x1d0 [btrfs]
        [59.198]  ? __pfx_autoremove_wake_function+0x10/0x10
        [59.198]  scrub_stripe+0x20d/0x740 [btrfs]
        [59.198]  scrub_chunk+0xc4/0x130 [btrfs]
        [59.198]  scrub_enumerate_chunks+0x3e4/0x7a0 [btrfs]
        [59.198]  ? __pfx_autoremove_wake_function+0x10/0x10
        [59.198]  btrfs_scrub_dev+0x236/0x6a0 [btrfs]
        [59.199]  ? btrfs_ioctl+0xd97/0x32c0 [btrfs]
        [59.199]  ? _copy_from_user+0x7b/0x80
        [59.199]  btrfs_ioctl+0xde1/0x32c0 [btrfs]
        [59.199]  ? refill_stock+0x33/0x50
        [59.199]  ? should_failslab+0xa/0x20
        [59.199]  ? kmem_cache_alloc_node+0x151/0x460
        [59.199]  ? alloc_io_context+0x1b/0x80
        [59.199]  ? preempt_count_add+0x70/0xa0
        [59.199]  ? __x64_sys_ioctl+0x88/0xc0
        [59.199]  __x64_sys_ioctl+0x88/0xc0
        [59.199]  do_syscall_64+0x38/0x90
        [59.199]  entry_SYSCALL_64_after_hwframe+0x72/0xdc
        [59.199] RIP: 0033:0x7f82ffaffe9b
        [59.199] RSP: 002b:00007f82ff9fcc50 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
        [59.199] RAX: ffffffffffffffda RBX: 000055b191e36310 RCX: 00007f82ffaffe9b
        [59.199] RDX: 000055b191e36310 RSI: 00000000c400941b RDI: 0000000000000003
        [59.199] RBP: 0000000000000000 R08: 00007fff1575016f R09: 0000000000000000
        [59.199] R10: 0000000000000000 R11: 0000000000000246 R12: 00007f82ff9fd640
        [59.199] R13: 000000000000006b R14: 00007f82ffa87580 R15: 0000000000000000
        [59.199]  </TASK>
        [59.199] INFO: task btrfs:346773 blocked for more than 120 seconds.
        [59.200]       Tainted: G        W          6.3.0-rc2-btrfs-next-127+ #1
        [59.200] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
        [59.201] task:btrfs           state:D stack:0     pid:346773 ppid:1      flags:0x00004002
        [59.201] Call Trace:
        [59.201]  <TASK>
        [59.201]  __schedule+0x392/0xa70
        [59.201]  ? __pv_queued_spin_lock_slowpath+0x165/0x370
        [59.201]  schedule+0x5d/0xd0
        [59.201]  __scrub_blocked_if_needed+0x74/0xc0 [btrfs]
        [59.201]  ? __pfx_autoremove_wake_function+0x10/0x10
        [59.201]  scrub_pause_off+0x21/0x50 [btrfs]
        [59.202]  scrub_simple_mirror+0x1c7/0x950 [btrfs]
        [59.202]  ? scrub_parity_put+0x1a5/0x1d0 [btrfs]
        [59.202]  ? __pfx_autoremove_wake_function+0x10/0x10
        [59.202]  scrub_stripe+0x20d/0x740 [btrfs]
        [59.202]  scrub_chunk+0xc4/0x130 [btrfs]
        [59.203]  scrub_enumerate_chunks+0x3e4/0x7a0 [btrfs]
        [59.203]  ? __pfx_autoremove_wake_function+0x10/0x10
        [59.203]  btrfs_scrub_dev+0x236/0x6a0 [btrfs]
        [59.203]  ? btrfs_ioctl+0xd97/0x32c0 [btrfs]
        [59.203]  ? _copy_from_user+0x7b/0x80
        [59.203]  btrfs_ioctl+0xde1/0x32c0 [btrfs]
        [59.204]  ? should_failslab+0xa/0x20
        [59.204]  ? kmem_cache_alloc_node+0x151/0x460
        [59.204]  ? alloc_io_context+0x1b/0x80
        [59.204]  ? preempt_count_add+0x70/0xa0
        [59.204]  ? __x64_sys_ioctl+0x88/0xc0
        [59.204]  __x64_sys_ioctl+0x88/0xc0
        [59.204]  do_syscall_64+0x38/0x90
        [59.204]  entry_SYSCALL_64_after_hwframe+0x72/0xdc
        [59.204] RIP: 0033:0x7f82ffaffe9b
        [59.204] RSP: 002b:00007f82ff1fbc50 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
        [59.204] RAX: ffffffffffffffda RBX: 000055b191e36790 RCX: 00007f82ffaffe9b
        [59.204] RDX: 000055b191e36790 RSI: 00000000c400941b RDI: 0000000000000003
        [59.204] RBP: 0000000000000000 R08: 00007fff1575016f R09: 0000000000000000
        [59.204] R10: 0000000000000000 R11: 0000000000000246 R12: 00007f82ff1fc640
        [59.204] R13: 000000000000006b R14: 00007f82ffa87580 R15: 0000000000000000
        [59.204]  </TASK>
        [59.204] INFO: task btrfs:346774 blocked for more than 120 seconds.
        [59.205]       Tainted: G        W          6.3.0-rc2-btrfs-next-127+ #1
        [59.205] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
        [59.206] task:btrfs           state:D stack:0     pid:346774 ppid:1      flags:0x00004002
        [59.206] Call Trace:
        [59.206]  <TASK>
        [59.206]  __schedule+0x392/0xa70
        [59.206]  schedule+0x5d/0xd0
        [59.206]  __scrub_blocked_if_needed+0x74/0xc0 [btrfs]
        [59.206]  ? __pfx_autoremove_wake_function+0x10/0x10
        [59.206]  scrub_pause_off+0x21/0x50 [btrfs]
        [59.207]  scrub_simple_mirror+0x1c7/0x950 [btrfs]
        [59.207]  ? scrub_parity_put+0x1a5/0x1d0 [btrfs]
        [59.207]  ? __pfx_autoremove_wake_function+0x10/0x10
        [59.207]  scrub_stripe+0x20d/0x740 [btrfs]
        [59.208]  scrub_chunk+0xc4/0x130 [btrfs]
        [59.208]  scrub_enumerate_chunks+0x3e4/0x7a0 [btrfs]
        [59.208]  ? __mutex_unlock_slowpath.isra.0+0x9a/0x120
        [59.208]  btrfs_scrub_dev+0x236/0x6a0 [btrfs]
        [59.208]  ? btrfs_ioctl+0xd97/0x32c0 [btrfs]
        [59.209]  ? _copy_from_user+0x7b/0x80
        [59.209]  btrfs_ioctl+0xde1/0x32c0 [btrfs]
        [59.209]  ? should_failslab+0xa/0x20
        [59.209]  ? kmem_cache_alloc_node+0x151/0x460
        [59.209]  ? alloc_io_context+0x1b/0x80
        [59.209]  ? preempt_count_add+0x70/0xa0
        [59.209]  ? __x64_sys_ioctl+0x88/0xc0
        [59.209]  __x64_sys_ioctl+0x88/0xc0
        [59.209]  do_syscall_64+0x38/0x90
        [59.209]  entry_SYSCALL_64_after_hwframe+0x72/0xdc
        [59.209] RIP: 0033:0x7f82ffaffe9b
        [59.209] RSP: 002b:00007f82fe9fac50 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
        [59.209] RAX: ffffffffffffffda RBX: 000055b191e36c10 RCX: 00007f82ffaffe9b
        [59.209] RDX: 000055b191e36c10 RSI: 00000000c400941b RDI: 0000000000000003
        [59.209] RBP: 0000000000000000 R08: 00007fff1575016f R09: 0000000000000000
        [59.209] R10: 0000000000000000 R11: 0000000000000246 R12: 00007f82fe9fb640
        [59.209] R13: 000000000000006b R14: 00007f82ffa87580 R15: 0000000000000000
        [59.209]  </TASK>
        [59.209] INFO: task btrfs:346775 blocked for more than 120 seconds.
        [59.210]       Tainted: G        W          6.3.0-rc2-btrfs-next-127+ #1
        [59.210] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
        [59.211] task:btrfs           state:D stack:0     pid:346775 ppid:1      flags:0x00004002
        [59.211] Call Trace:
        [59.211]  <TASK>
        [59.211]  __schedule+0x392/0xa70
        [59.211]  schedule+0x5d/0xd0
        [59.211]  __scrub_blocked_if_needed+0x74/0xc0 [btrfs]
        [59.211]  ? __pfx_autoremove_wake_function+0x10/0x10
        [59.211]  scrub_pause_off+0x21/0x50 [btrfs]
        [59.212]  scrub_simple_mirror+0x1c7/0x950 [btrfs]
        [59.212]  ? scrub_parity_put+0x1a5/0x1d0 [btrfs]
        [59.212]  ? __pfx_autoremove_wake_function+0x10/0x10
        [59.212]  scrub_stripe+0x20d/0x740 [btrfs]
        [59.213]  scrub_chunk+0xc4/0x130 [btrfs]
        [59.213]  scrub_enumerate_chunks+0x3e4/0x7a0 [btrfs]
        [59.213]  ? __mutex_unlock_slowpath.isra.0+0x9a/0x120
        [59.213]  btrfs_scrub_dev+0x236/0x6a0 [btrfs]
        [59.213]  ? btrfs_ioctl+0xd97/0x32c0 [btrfs]
        [59.214]  ? _copy_from_user+0x7b/0x80
        [59.214]  btrfs_ioctl+0xde1/0x32c0 [btrfs]
        [59.214]  ? should_failslab+0xa/0x20
        [59.214]  ? kmem_cache_alloc_node+0x151/0x460
        [59.214]  ? alloc_io_context+0x1b/0x80
        [59.214]  ? preempt_count_add+0x70/0xa0
        [59.214]  ? __x64_sys_ioctl+0x88/0xc0
        [59.214]  __x64_sys_ioctl+0x88/0xc0
        [59.214]  do_syscall_64+0x38/0x90
        [59.214]  entry_SYSCALL_64_after_hwframe+0x72/0xdc
        [59.214] RIP: 0033:0x7f82ffaffe9b
        [59.214] RSP: 002b:00007f82fe1f9c50 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
        [59.214] RAX: ffffffffffffffda RBX: 000055b191e37090 RCX: 00007f82ffaffe9b
        [59.214] RDX: 000055b191e37090 RSI: 00000000c400941b RDI: 0000000000000003
        [59.214] RBP: 0000000000000000 R08: 00007fff1575016f R09: 0000000000000000
        [59.214] R10: 0000000000000000 R11: 0000000000000246 R12: 00007f82fe1fa640
        [59.214] R13: 000000000000006b R14: 00007f82ffa87580 R15: 0000000000000000
        [59.214]  </TASK>
        [59.214] INFO: task btrfs:346776 blocked for more than 120 seconds.
        [59.215]       Tainted: G        W          6.3.0-rc2-btrfs-next-127+ #1
        [59.216] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
        [59.217] task:btrfs           state:D stack:0     pid:346776 ppid:1      flags:0x00004002
        [59.217] Call Trace:
        [59.217]  <TASK>
        [59.217]  __schedule+0x392/0xa70
        [59.217]  ? __pv_queued_spin_lock_slowpath+0x165/0x370
        [59.217]  schedule+0x5d/0xd0
        [59.217]  __scrub_blocked_if_needed+0x74/0xc0 [btrfs]
        [59.217]  ? __pfx_autoremove_wake_function+0x10/0x10
        [59.217]  scrub_pause_off+0x21/0x50 [btrfs]
        [59.217]  scrub_simple_mirror+0x1c7/0x950 [btrfs]
        [59.217]  ? scrub_parity_put+0x1a5/0x1d0 [btrfs]
        [59.218]  ? __pfx_autoremove_wake_function+0x10/0x10
        [59.218]  scrub_stripe+0x20d/0x740 [btrfs]
        [59.218]  scrub_chunk+0xc4/0x130 [btrfs]
        [59.218]  scrub_enumerate_chunks+0x3e4/0x7a0 [btrfs]
        [59.219]  ? __pfx_autoremove_wake_function+0x10/0x10
        [59.219]  btrfs_scrub_dev+0x236/0x6a0 [btrfs]
        [59.219]  ? btrfs_ioctl+0xd97/0x32c0 [btrfs]
        [59.219]  ? _copy_from_user+0x7b/0x80
        [59.219]  btrfs_ioctl+0xde1/0x32c0 [btrfs]
        [59.219]  ? should_failslab+0xa/0x20
        [59.219]  ? kmem_cache_alloc_node+0x151/0x460
        [59.219]  ? alloc_io_context+0x1b/0x80
        [59.219]  ? preempt_count_add+0x70/0xa0
        [59.219]  ? __x64_sys_ioctl+0x88/0xc0
        [59.219]  __x64_sys_ioctl+0x88/0xc0
        [59.219]  do_syscall_64+0x38/0x90
        [59.219]  entry_SYSCALL_64_after_hwframe+0x72/0xdc
        [59.219] RIP: 0033:0x7f82ffaffe9b
        [59.219] RSP: 002b:00007f82fd9f8c50 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
        [59.219] RAX: ffffffffffffffda RBX: 000055b191e37510 RCX: 00007f82ffaffe9b
        [59.219] RDX: 000055b191e37510 RSI: 00000000c400941b RDI: 0000000000000003
        [59.219] RBP: 0000000000000000 R08: 00007fff1575016f R09: 0000000000000000
        [59.219] R10: 0000000000000000 R11: 0000000000000246 R12: 00007f82fd9f9640
        [59.219] R13: 000000000000006b R14: 00007f82ffa87580 R15: 0000000000000000
        [59.219]  </TASK>
        [59.219] INFO: task btrfs:346822 blocked for more than 120 seconds.
        [59.220]       Tainted: G        W          6.3.0-rc2-btrfs-next-127+ #1
        [59.221] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
        [59.222] task:btrfs           state:D stack:0     pid:346822 ppid:1      flags:0x00004002
        [59.222] Call Trace:
        [59.222]  <TASK>
        [59.222]  __schedule+0x392/0xa70
        [59.222]  schedule+0x5d/0xd0
        [59.222]  btrfs_scrub_cancel+0x91/0x100 [btrfs]
        [59.222]  ? __pfx_autoremove_wake_function+0x10/0x10
        [59.222]  btrfs_commit_transaction+0x572/0xeb0 [btrfs]
        [59.223]  ? start_transaction+0xcb/0x610 [btrfs]
        [59.223]  prepare_to_relocate+0x111/0x1a0 [btrfs]
        [59.223]  relocate_block_group+0x57/0x5d0 [btrfs]
        [59.223]  ? btrfs_wait_nocow_writers+0x25/0xb0 [btrfs]
        [59.223]  btrfs_relocate_block_group+0x248/0x3c0 [btrfs]
        [59.224]  ? __pfx_autoremove_wake_function+0x10/0x10
        [59.224]  btrfs_relocate_chunk+0x3b/0x150 [btrfs]
        [59.224]  btrfs_balance+0x8ff/0x11d0 [btrfs]
        [59.224]  ? __kmem_cache_alloc_node+0x14a/0x410
        [59.224]  btrfs_ioctl+0x2334/0x32c0 [btrfs]
        [59.225]  ? mod_objcg_state+0xd2/0x360
        [59.225]  ? refill_obj_stock+0xb0/0x160
        [59.225]  ? seq_release+0x25/0x30
        [59.225]  ? __rseq_handle_notify_resume+0x3b5/0x4b0
        [59.225]  ? percpu_counter_add_batch+0x2e/0xa0
        [59.225]  ? __x64_sys_ioctl+0x88/0xc0
        [59.225]  __x64_sys_ioctl+0x88/0xc0
        [59.225]  do_syscall_64+0x38/0x90
        [59.225]  entry_SYSCALL_64_after_hwframe+0x72/0xdc
        [59.225] RIP: 0033:0x7f381a6ffe9b
        [59.225] RSP: 002b:00007ffd45ecf060 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
        [59.225] RAX: ffffffffffffffda RBX: 0000000000000001 RCX: 00007f381a6ffe9b
        [59.225] RDX: 00007ffd45ecf150 RSI: 00000000c4009420 RDI: 0000000000000003
        [59.225] RBP: 0000000000000003 R08: 0000000000000013 R09: 0000000000000000
        [59.225] R10: 00007f381a60c878 R11: 0000000000000246 R12: 00007ffd45ed0423
        [59.225] R13: 00007ffd45ecf150 R14: 0000000000000000 R15: 00007ffd45ecf148
        [59.225]  </TASK>
      
      What happens is the following:
      
      1) A scrub is running, so fs_info->scrubs_running is 1;
      
      2) Task A starts block group relocation, and at btrfs_relocate_chunk() it
         pauses scrub by calling btrfs_scrub_pause(). That increments
         fs_info->scrub_pause_req from 0 to 1 and waits for the scrub task to
         pause (for fs_info->scrubs_paused to be == to fs_info->scrubs_running);
      
      3) The scrub task pauses at scrub_pause_off(), waiting for
         fs_info->scrub_pause_req to decrease to 0;
      
      4) Task A then enters btrfs_relocate_block_group(), and down that call
         chain we start a transaction and then attempt to commit it;
      
      5) When task A calls btrfs_commit_transaction(), it either will do the
         commit itself or wait for some other task that already started the
         commit of the transaction - it doesn't matter which case;
      
      6) The transaction commit enters state TRANS_STATE_COMMIT_START;
      
      7) An error happens during the transaction commit, like -ENOSPC when
         running delayed refs or delayed items for example;
      
      8) This results in calling transaction.c:cleanup_transaction(), where
         we call btrfs_scrub_cancel(), incrementing fs_info->scrub_cancel_req
         from 0 to 1, and blocking this task waiting for fs_info->scrubs_running
         to decrease to 0;
      
      9) From this point on, both the transaction commit and the scrub task
         hang forever:
      
         1) The transaction commit is waiting for fs_info->scrubs_running to
            be decreased to 0;
      
         2) The scrub task is at scrub_pause_off() waiting for
            fs_info->scrub_pause_req to decrease to 0 - so it can not proceed
            to stop the scrub and decrement fs_info->scrubs_running from 0 to 1.
      
         Therefore resulting in a deadlock.
      
      Fix this by having cleanup_transaction(), called if a transaction commit
      fails, not call btrfs_scrub_cancel() if relocation is in progress, and
      having btrfs_relocate_block_group() call btrfs_scrub_cancel() instead if
      the relocation failed and a transaction abort happened.
      
      This was triggered with btrfs/061 from fstests.
      
      Fixes: 55e3a601
      
       ("btrfs: Fix data checksum error cause by replace with io-load.")
      CC: stable@vger.kernel.org # 4.14+
      Reviewed-by: default avatarJosef Bacik <josef@toxicpanda.com>
      Signed-off-by: default avatarFilipe Manana <fdmanana@suse.com>
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6134a4bb
    • Hans de Goede's avatar
      Input: goodix - add Lenovo Yoga Book X90F to nine_bytes_report DMI table · 85ec4419
      Hans de Goede authored
      commit 8a0432ba
      
       upstream.
      
      The Android Lenovo Yoga Book X90F / X90L uses the same goodix touchscreen
      with 9 bytes touch reports for its touch keyboard as the already supported
      Windows Lenovo Yoga Book X91F/L, add a DMI match for this to
      the nine_bytes_report DMI table.
      
      When the quirk for the X91F/L was initially added it was written to
      also apply to the X90F/L but this does not work because the Android
      version of the Yoga Book uses completely different DMI strings.
      Also adjust the X91F/L quirk to reflect that it only applies to
      the X91F/L models.
      
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Reviewed-by: default avatarBastien Nocera <hadess@hadess.net>
      Link: https://lore.kernel.org/r/20230315134442.71787-1-hdegoede@redhat.com
      
      
      Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      85ec4419
    • Jonathan Denose's avatar
      Input: i8042 - add quirk for Fujitsu Lifebook A574/H · 89c4b695
      Jonathan Denose authored
      commit f5bad62f
      
       upstream.
      
      Fujitsu Lifebook A574/H requires the nomux option to properly
      probe the touchpad, especially when waking from sleep.
      
      Signed-off-by: default avatarJonathan Denose <jdenose@google.com>
      Reviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
      Link: https://lore.kernel.org/r/20230303152623.45859-1-jdenose@google.com
      
      
      Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      89c4b695
    • David Disseldorp's avatar
      cifs: fix DFS traversal oops without CONFIG_CIFS_DFS_UPCALL · b7d854c3
      David Disseldorp authored
      commit 179a88a8
      
       upstream.
      
      When compiled with CONFIG_CIFS_DFS_UPCALL disabled, cifs_dfs_d_automount
      is NULL. cifs.ko logic for mapping CIFS_FATTR_DFS_REFERRAL attributes to
      S_AUTOMOUNT and corresponding dentry flags is retained regardless of
      CONFIG_CIFS_DFS_UPCALL, leading to a NULL pointer dereference in
      VFS follow_automount() when traversing a DFS referral link:
        BUG: kernel NULL pointer dereference, address: 0000000000000000
        ...
        Call Trace:
         <TASK>
         __traverse_mounts+0xb5/0x220
         ? cifs_revalidate_mapping+0x65/0xc0 [cifs]
         step_into+0x195/0x610
         ? lookup_fast+0xe2/0xf0
         path_lookupat+0x64/0x140
         filename_lookup+0xc2/0x140
         ? __create_object+0x299/0x380
         ? kmem_cache_alloc+0x119/0x220
         ? user_path_at_empty+0x31/0x50
         user_path_at_empty+0x31/0x50
         __x64_sys_chdir+0x2a/0xd0
         ? exit_to_user_mode_prepare+0xca/0x100
         do_syscall_64+0x42/0x90
         entry_SYSCALL_64_after_hwframe+0x72/0xdc
      
      This fix adds an inline cifs_dfs_d_automount() {return -EREMOTE} handler
      when CONFIG_CIFS_DFS_UPCALL is disabled. An alternative would be to
      avoid flagging S_AUTOMOUNT, etc. without CONFIG_CIFS_DFS_UPCALL. This
      approach was chosen as it provides more control over the error path.
      
      Signed-off-by: default avatarDavid Disseldorp <ddiss@suse.de>
      Cc: stable@vger.kernel.org
      Reviewed-by: default avatarPaulo Alcantara (SUSE) <pc@manguebit.com>
      Reviewed-by: default avatarRonnie Sahlberg <lsahlber@redhat.com>
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b7d854c3
    • Paulo Alcantara's avatar
      cifs: prevent infinite recursion in CIFSGetDFSRefer() · eb94ea52
      Paulo Alcantara authored
      commit 09ba47b4
      
       upstream.
      
      We can't call smb_init() in CIFSGetDFSRefer() as cifs_reconnect_tcon()
      may end up calling CIFSGetDFSRefer() again to get new DFS referrals
      and thus causing an infinite recursion.
      
      Signed-off-by: default avatarPaulo Alcantara (SUSE) <pc@manguebit.com>
      Reviewed-by: default avatarRonnie Sahlberg <lsahlber@redhat.com>
      Cc: stable@vger.kernel.org # 6.2
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      eb94ea52
    • Jason A. Donenfeld's avatar
      Input: focaltech - use explicitly signed char type · f8bdc959
      Jason A. Donenfeld authored
      commit 8980f190 upstream.
      
      The recent change of -funsigned-char causes additions of negative
      numbers to become additions of large positive numbers, leading to wrong
      calculations of mouse movement. Change these casts to be explicitly
      signed, to take into account negative offsets.
      
      Fixes: 3bc753c0
      
       ("kbuild: treat char as always unsigned")
      Signed-off-by: default avatarJason A. Donenfeld <Jason@zx2c4.com>
      Reviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
      Cc: stable@vger.kernel.org
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=217211
      Link: https://lore.kernel.org/r/20230318133010.1285202-1-Jason@zx2c4.com
      
      
      Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f8bdc959
    • msizanoen's avatar
      Input: alps - fix compatibility with -funsigned-char · 5ee6df52
      msizanoen authored
      commit 754ff506 upstream.
      
      The AlpsPS/2 code previously relied on the assumption that `char` is a
      signed type, which was true on x86 platforms (the only place where this
      driver is used) before kernel 6.2. However, on 6.2 and later, this
      assumption is broken due to the introduction of -funsigned-char as a new
      global compiler flag.
      
      Fix this by explicitly specifying the signedness of `char` when sign
      extending the values received from the device.
      
      Fixes: f3f33c67
      
       ("Input: alps - Rushmore and v7 resolution support")
      Signed-off-by: default avatarmsizanoen <msizanoen@qtmlabs.xyz>
      Cc: stable@vger.kernel.org
      Link: https://lore.kernel.org/r/20230320045228.182259-1-msizanoen@qtmlabs.xyz
      
      
      Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5ee6df52
    • Werner Sembach's avatar
      Input: i8042 - add TUXEDO devices to i8042 quirk tables for partial fix · 30a8863f
      Werner Sembach authored
      commit cbedf1a3
      
       upstream.
      
      A lot of modern Clevo barebones have touchpad and/or keyboard issues after
      suspend fixable with nomux + reset + noloop + nopnp. Luckily, none of them
      have an external PS/2 port so this can safely be set for all of them.
      
      I'm not entirely sure if every device listed really needs all four quirks,
      but after testing and production use, no negative effects could be
      observed when setting all four.
      
      Setting SERIO_QUIRK_NOMUX or SERIO_QUIRK_RESET_ALWAYS on the Clevo N150CU
      and the Clevo NHxxRZQ makes the keyboard very laggy for ~5 seconds after
      boot and sometimes also after resume. However both are required for the
      keyboard to not fail completely sometimes after boot or resume.
      
      Signed-off-by: default avatarWerner Sembach <wse@tuxedocomputers.com>
      Cc: stable@vger.kernel.org
      Link: https://lore.kernel.org/r/20230321191619.647911-1-wse@tuxedocomputers.com
      
      
      Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      30a8863f
    • Lu Baolu's avatar
      iommu/vt-d: Allow zero SAGAW if second-stage not supported · 973043d6
      Lu Baolu authored
      [ Upstream commit bfd3c6b9 ]
      
      The VT-d spec states (in section 11.4.2) that hardware implementations
      reporting second-stage translation support (SSTS) field as Clear also
      report the SAGAW field as 0. Fix an inappropriate check in alloc_iommu().
      
      Fixes: 792fb43c
      
       ("iommu/vt-d: Enable Intel IOMMU scalable mode by default")
      Suggested-by: default avatarRaghunathan Srinivasan <raghunathan.srinivasan@intel.com>
      Reviewed-by: default avatarKevin Tian <kevin.tian@intel.com>
      Signed-off-by: default avatarJacob Pan <jacob.jun.pan@linux.intel.com>
      Signed-off-by: default avatarLu Baolu <baolu.lu@linux.intel.com>
      Link: https://lore.kernel.org/r/20230318024824.124542-1-baolu.lu@linux.intel.com
      Link: https://lore.kernel.org/r/20230329134721.469447-3-baolu.lu@linux.intel.com
      
      
      Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      973043d6
    • Matthias Benkmann's avatar
      Input: xpad - fix incorrectly applied patch for MAP_PROFILE_BUTTON · db0ac149
      Matthias Benkmann authored
      [ Upstream commit ffa6206e ]
      
      When commit commit fff1011a ("Input: xpad - add X-Box Adaptive Profile
      button") was applied, one hunk ended up in the wrong function; move it to
      where it belongs.
      
      Fixes: fff1011a
      
       ("Input: xpad - add X-Box Adaptive Profile button")
      Signed-off-by: default avatarMatthias Benkmann <matthias.benkmann@gmail.com>
      Link: https://lore.kernel.org/r/20230318162106.0aef4ba5@ninja
      
      
      Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      db0ac149
    • Horatiu Vultur's avatar
      pinctrl: ocelot: Fix alt mode for ocelot · 2a858f3f
      Horatiu Vultur authored
      [ Upstream commit 657fd9da ]
      
      In case the driver was trying to set an alternate mode for gpio
      0 or 32 then the mode was not set correctly. The reason is that
      there is computation error inside the function ocelot_pinmux_set_mux
      because in this case it was trying to shift to left by -1.
      Fix this by actually shifting the function bits and not the position.
      
      Fixes: 4b36082e
      
       ("pinctrl: ocelot: fix pinmuxing for pins after 31")
      Signed-off-by: default avatarHoratiu Vultur <horatiu.vultur@microchip.com>
      Link: https://lore.kernel.org/r/20230206203720.1177718-1-horatiu.vultur@microchip.com
      
      
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      2a858f3f
    • Felix Fietkau's avatar
      net: ethernet: mtk_eth_soc: add missing ppe cache flush when deleting a flow · 106fb49b
      Felix Fietkau authored
      [ Upstream commit 92453132 ]
      
      The cache needs to be flushed to ensure that the hardware stops offloading
      the flow immediately.
      
      Fixes: 33fc42de
      
       ("net: ethernet: mtk_eth_soc: support creating mac address based offload entries")
      Reviewed-by: default avatarSimon Horman <simon.horman@corigine.com>
      Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
      Reviewed-by: default avatarLeon Romanovsky <leonro@nvidia.com>
      Link: https://lore.kernel.org/r/20230330120840.52079-3-nbd@nbd.name
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      106fb49b
    • Felix Fietkau's avatar
      net: ethernet: mtk_eth_soc: fix flow block refcounting logic · a7bd974e
      Felix Fietkau authored
      [ Upstream commit 8c1cb87c ]
      
      Since we call flow_block_cb_decref on FLOW_BLOCK_UNBIND, we also need to
      call flow_block_cb_incref for a newly allocated cb.
      Also fix the accidentally inverted refcount check on unbind.
      
      Fixes: 502e84e2
      
       ("net: ethernet: mtk_eth_soc: add flow offloading support")
      Reviewed-by: default avatarSimon Horman <simon.horman@corigine.com>
      Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
      Reviewed-by: default avatarLeon Romanovsky <leonro@nvidia.com>
      Link: https://lore.kernel.org/r/20230330120840.52079-1-nbd@nbd.name
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      a7bd974e
    • Steffen Bätz's avatar
      net: dsa: mv88e6xxx: Enable IGMP snooping on user ports only · 1b0e8aba
      Steffen Bätz authored
      [ Upstream commit 7bcad0f0 ]
      
      Do not set the MV88E6XXX_PORT_CTL0_IGMP_MLD_SNOOP bit on CPU or DSA ports.
      
      This allows the host CPU port to be a regular IGMP listener by sending out
      IGMP Membership Reports, which would otherwise not be forwarded by the
      mv88exxx chip, but directly looped back to the CPU port itself.
      
      Fixes: 54d792f2
      
       ("net: dsa: Centralise global and port setup code into mv88e6xxx.")
      Signed-off-by: default avatarSteffen Bätz <steffen@innosonix.de>
      Signed-off-by: default avatarFabio Estevam <festevam@denx.de>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Reviewed-by: default avatarVladimir Oltean <olteanv@gmail.com>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Link: https://lore.kernel.org/r/20230329150140.701559-1-festevam@gmail.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      1b0e8aba
    • Michael Chan's avatar
      bnxt_en: Add missing 200G link speed reporting · b055e322
      Michael Chan authored
      [ Upstream commit 581bce7b ]
      
      bnxt_fw_to_ethtool_speed() is missing the case statement for 200G
      link speed reported by firmware.  As a result, ethtool will report
      unknown speed when the firmware reports 200G link speed.
      
      Fixes: 532262ba
      
       ("bnxt_en: ethtool: support PAM4 link speeds up to 200G")
      Signed-off-by: default avatarMichael Chan <michael.chan@broadcom.com>
      Reviewed-by: default avatarSimon Horman <simon.horman@corigine.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      b055e322
    • Kalesh AP's avatar
      bnxt_en: Fix typo in PCI id to device description string mapping · f06ae13e
      Kalesh AP authored
      [ Upstream commit 62aad36e ]
      
      Fix 57502 and 57508 NPAR description string entries.  The typos
      caused these devices to not match up with lspci output.
      
      Fixes: 49c98421
      
       ("bnxt_en: Add PCI IDs for 57500 series NPAR devices.")
      Reviewed-by: default avatarPavan Chebbi <pavan.chebbi@broadcom.com>
      Signed-off-by: default avatarKalesh AP <kalesh-anakkur.purayil@broadcom.com>
      Signed-off-by: default avatarMichael Chan <michael.chan@broadcom.com>
      Reviewed-by: default avatarSimon Horman <simon.horman@corigine.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      f06ae13e
    • Kalesh AP's avatar
      bnxt_en: Fix reporting of test result in ethtool selftest · a4dd9f75
      Kalesh AP authored
      [ Upstream commit 83714dc3 ]
      
      When the selftest command fails, driver is not reporting the failure
      by updating the "test->flags" when bnxt_close_nic() fails.
      
      Fixes: eb513658
      
       ("bnxt_en: Add basic ethtool -t selftest support.")
      Reviewed-by: default avatarPavan Chebbi <pavan.chebbi@broadcom.com>
      Reviewed-by: default avatarSomnath Kotur <somnath.kotur@broadcom.com>
      Signed-off-by: default avatarKalesh AP <kalesh-anakkur.purayil@broadcom.com>
      Signed-off-by: default avatarMichael Chan <michael.chan@broadcom.com>
      Reviewed-by: default avatarSimon Horman <simon.horman@corigine.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      a4dd9f75
    • Radoslaw Tyl's avatar
      i40e: fix registers dump after run ethtool adapter self test · 37f9fe34
      Radoslaw Tyl authored
      [ Upstream commit c5cff16f ]
      
      Fix invalid registers dump from ethtool -d ethX after adapter self test
      by ethtool -t ethY. It causes invalid data display.
      
      The problem was caused by overwriting i40e_reg_list[].elements
      which is common for ethtool self test and dump.
      
      Fixes: 22dd9ae8
      
       ("i40e: Rework register diagnostic")
      Signed-off-by: default avatarRadoslaw Tyl <radoslawx.tyl@intel.com>
      Reviewed-by: default avatarMichal Swiatkowski <michal.swiatkowski@linux.intel.com>
      Tested-by: Arpana Arland <arpanax.arland@intel.com> (A Contingent worker at Intel)
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      Reviewed-by: default avatarLeon Romanovsky <leonro@nvidia.com>
      Link: https://lore.kernel.org/r/20230328172659.3906413-1-anthony.l.nguyen@intel.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      37f9fe34
    • Alex Elder's avatar
      net: ipa: compute DMA pool size properly · 6e43dc9d
      Alex Elder authored
      [ Upstream commit 6c75dc94
      
       ]
      
      In gsi_trans_pool_init_dma(), the total size of a pool of memory
      used for DMA transactions is calculated.  However the calculation is
      done incorrectly.
      
      For 4KB pages, this total size is currently always more than one
      page, and as a result, the calculation produces a positive (though
      incorrect) total size.  The code still works in this case; we just
      end up with fewer DMA pool entries than we intended.
      
      Bjorn Andersson tested booting a kernel with 16KB pages, and hit a
      null pointer derereference in sg_alloc_append_table_from_pages(),
      descending from gsi_trans_pool_init_dma().  The cause of this was
      that a 16KB total size was going to be allocated, and with 16KB
      pages the order of that allocation is 0.  The total_size calculation
      yielded 0, which eventually led to the crash.
      
      Correcting the total_size calculation fixes the problem.
      
      Reported-by: default avatarBjorn Andersson <quic_bjorande@quicinc.com>
      Tested-by: default avatarBjorn Andersson <quic_bjorande@quicinc.com>
      Fixes: 9dd441e4
      
       ("soc: qcom: ipa: GSI transactions")
      Reviewed-by: default avatarMark Bloch <mbloch@nvidia.com>
      Signed-off-by: default avatarAlex Elder <elder@linaro.org>
      Reviewed-by: default avatarLeon Romanovsky <leonro@nvidia.com>
      Link: https://lore.kernel.org/r/20230328162751.2861791-1-elder@linaro.org
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      6e43dc9d
    • Tasos Sahanidis's avatar
      ALSA: ymfpci: Fix BUG_ON in probe function · 32b9bd7c
      Tasos Sahanidis authored
      [ Upstream commit 6be2e752 ]
      
      The snd_dma_buffer.bytes field now contains the aligned size, which this
      snd_BUG_ON() did not account for, resulting in the following:
      
      [    9.625915] ------------[ cut here ]------------
      [    9.633440] WARNING: CPU: 0 PID: 126 at sound/pci/ymfpci/ymfpci_main.c:2168 snd_ymfpci_create+0x681/0x698 [snd_ymfpci]
      [    9.648926] Modules linked in: snd_ymfpci(+) snd_intel_dspcfg kvm(+) snd_intel_sdw_acpi snd_ac97_codec snd_mpu401_uart snd_opl3_lib irqbypass snd_hda_codec gameport snd_rawmidi crct10dif_pclmul crc32_pclmul cfg80211 snd_hda_core polyval_clmulni polyval_generic gf128mul snd_seq_device ghash_clmulni_intel snd_hwdep ac97_bus sha512_ssse3 rfkill snd_pcm aesni_intel tg3 snd_timer crypto_simd snd mxm_wmi libphy cryptd k10temp fam15h_power pcspkr soundcore sp5100_tco wmi acpi_cpufreq mac_hid dm_multipath sg loop fuse dm_mod bpf_preload ip_tables x_tables ext4 crc32c_generic crc16 mbcache jbd2 sr_mod cdrom ata_generic pata_acpi firewire_ohci crc32c_intel firewire_core xhci_pci crc_itu_t pata_via xhci_pci_renesas floppy
      [    9.711849] CPU: 0 PID: 126 Comm: kworker/0:2 Not tainted 6.1.21-1-lts #1 08d2e5ece03136efa7c6aeea9a9c40916b1bd8da
      [    9.722200] Hardware name: To Be Filled By O.E.M. To Be Filled By O.E.M./990FX Extreme4, BIOS P2.70 06/05/2014
      [    9.732204] Workqueue: events work_for_cpu_fn
      [    9.736580] RIP: 0010:snd_ymfpci_create+0x681/0x698 [snd_ymfpci]
      [    9.742594] Code: 8c c0 4c 89 e2 48 89 df 48 c7 c6 92 c6 8c c0 e8 15 d0 e9 ff 48 83 c4 08 44 89 e8 5b 5d 41 5c 41 5d 41 5e 41 5f e9 d3 7a 33 e3 <0f> 0b e9 cb fd ff ff 41 bd fb ff ff ff eb db 41 bd f4 ff ff ff eb
      [    9.761358] RSP: 0018:ffffab64804e7da0 EFLAGS: 00010287
      [    9.766594] RAX: ffff8fa2df06c400 RBX: ffff8fa3073a8000 RCX: ffff8fa303fbc4a8
      [    9.773734] RDX: ffff8fa2df06d000 RSI: 0000000000000010 RDI: 0000000000000020
      [    9.780876] RBP: ffff8fa300b5d0d0 R08: ffff8fa3073a8e50 R09: 00000000df06bf00
      [    9.788018] R10: ffff8fa2df06bf00 R11: 00000000df068200 R12: ffff8fa3073a8918
      [    9.795159] R13: 0000000000000000 R14: 0000000000000080 R15: ffff8fa2df068200
      [    9.802317] FS:  0000000000000000(0000) GS:ffff8fa9fec00000(0000) knlGS:0000000000000000
      [    9.810414] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [    9.816158] CR2: 000055febaf66500 CR3: 0000000101a2e000 CR4: 00000000000406f0
      [    9.823301] Call Trace:
      [    9.825747]  <TASK>
      [    9.827889]  snd_card_ymfpci_probe+0x194/0x950 [snd_ymfpci b78a5fe64b5663a6390a909c67808567e3e73615]
      [    9.837030]  ? finish_task_switch.isra.0+0x90/0x2d0
      [    9.841918]  local_pci_probe+0x45/0x80
      [    9.845680]  work_for_cpu_fn+0x1a/0x30
      [    9.849431]  process_one_work+0x1c7/0x380
      [    9.853464]  worker_thread+0x1af/0x390
      [    9.857225]  ? rescuer_thread+0x3b0/0x3b0
      [    9.861254]  kthread+0xde/0x110
      [    9.864414]  ? kthread_complete_and_exit+0x20/0x20
      [    9.869210]  ret_from_fork+0x22/0x30
      [    9.872792]  </TASK>
      [    9.874985] ---[ end trace 0000000000000000 ]---
      
      Fixes: 5c1733e3
      
       ("ALSA: memalloc: Align buffer allocations in page size")
      Signed-off-by: default avatarTasos Sahanidis <tasos@tasossah.com>
      Link: https://lore.kernel.org/r/20230329032808.170403-1-tasos@tasossah.com
      
      
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      32b9bd7c
    • Tasos Sahanidis's avatar
      ALSA: ymfpci: Create card with device-managed snd_devm_card_new() · db7d7782
      Tasos Sahanidis authored
      [ Upstream commit f33fc157 ]
      
      snd_card_ymfpci_remove() was removed in commit c6e6bb5e ("ALSA:
      ymfpci: Allocate resources with device-managed APIs"), but the call to
      snd_card_new() was not replaced with snd_devm_card_new().
      
      Since there was no longer a call to snd_card_free, unloading the module
      would eventually result in Oops:
      
      [697561.532887] BUG: unable to handle page fault for address: ffffffffc0924480
      [697561.532893] #PF: supervisor read access in kernel mode
      [697561.532896] #PF: error_code(0x0000) - not-present page
      [697561.532899] PGD ae1e15067 P4D ae1e15067 PUD ae1e17067 PMD 11a8f5067 PTE 0
      [697561.532905] Oops: 0000 [#1] PREEMPT SMP NOPTI
      [697561.532909] CPU: 21 PID: 5080 Comm: wireplumber Tainted: G        W  OE      6.2.7 #1
      [697561.532914] Hardware name: System manufacturer System Product Name/TUF GAMING X570-PLUS, BIOS 4408 10/28/2022
      [697561.532916] RIP: 0010:try_module_get.part.0+0x1a/0xe0
      [697561.532924] Code: 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 0f 1f 44 00 00 55 48 89 e5 41 55 41 54 49 89 fc bf 01 00 00 00 e8 56 3c f8 ff <41> 83 3c 24 02 0f 84 96 00 00 00 41 8b 84 24 30 03 00 00 85 c0 0f
      [697561.532927] RSP: 0018:ffffbe9b858c3bd8 EFLAGS: 00010246
      [697561.532930] RAX: ffff9815d14f1900 RBX: ffff9815c14e6000 RCX: 0000000000000000
      [697561.532933] RDX: 0000000000000000 RSI: ffffffffc055092c RDI: ffffffffb3778c1a
      [697561.532935] RBP: ffffbe9b858c3be8 R08: 0000000000000040 R09: ffff981a1a741380
      [697561.532937] R10: ffffbe9b858c3c80 R11: 00000009d56533a6 R12: ffffffffc0924480
      [697561.532939] R13: ffff9823439d8500 R14: 0000000000000025 R15: ffff9815cd109f80
      [697561.532942] FS:  00007f13084f1f80(0000) GS:ffff9824aef40000(0000) knlGS:0000000000000000
      [697561.532945] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [697561.532947] CR2: ffffffffc0924480 CR3: 0000000145344000 CR4: 0000000000350ee0
      [697561.532949] Call Trace:
      [697561.532951]  <TASK>
      [697561.532955]  try_module_get+0x13/0x30
      [697561.532960]  snd_ctl_open+0x61/0x1c0 [snd]
      [697561.532976]  snd_open+0xb4/0x1e0 [snd]
      [697561.532989]  chrdev_open+0xc7/0x240
      [697561.532995]  ? fsnotify_perm.part.0+0x6e/0x160
      [697561.533000]  ? __pfx_chrdev_open+0x10/0x10
      [697561.533005]  do_dentry_open+0x169/0x440
      [697561.533009]  vfs_open+0x2d/0x40
      [697561.533012]  path_openat+0xa9d/0x10d0
      [697561.533017]  ? debug_smp_processor_id+0x17/0x20
      [697561.533022]  ? trigger_load_balance+0x65/0x370
      [697561.533026]  do_filp_open+0xb2/0x160
      [697561.533032]  ? _raw_spin_unlock+0x19/0x40
      [697561.533036]  ? alloc_fd+0xa9/0x190
      [697561.533040]  do_sys_openat2+0x9f/0x160
      [697561.533044]  __x64_sys_openat+0x55/0x90
      [697561.533048]  do_syscall_64+0x3b/0x90
      [697561.533052]  entry_SYSCALL_64_after_hwframe+0x72/0xdc
      [697561.533056] RIP: 0033:0x7f1308a40db4
      [697561.533059] Code: 24 20 eb 8f 66 90 44 89 54 24 0c e8 46 68 f8 ff 44 8b 54 24 0c 44 89 e2 48 89 ee 41 89 c0 bf 9c ff ff ff b8 01 01 00 00 0f 05 <48> 3d 00 f0 ff ff 77 32 44 89 c7 89 44 24 0c e8 78 68 f8 ff 8b 44
      [697561.533062] RSP: 002b:00007ffcce664450 EFLAGS: 00000293 ORIG_RAX: 0000000000000101
      [697561.533066] RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 00007f1308a40db4
      [697561.533068] RDX: 0000000000080000 RSI: 00007ffcce664690 RDI: 00000000ffffff9c
      [697561.533070] RBP: 00007ffcce664690 R08: 0000000000000000 R09: 0000000000000012
      [697561.533072] R10: 0000000000000000 R11: 0000000000000293 R12: 0000000000080000
      [697561.533074] R13: 00007f13054b069b R14: 0000565209f83200 R15: 0000000000000000
      [697561.533078]  </TASK>
      
      Fixes: c6e6bb5e
      
       ("ALSA: ymfpci: Allocate resources with device-managed APIs")
      Signed-off-by: default avatarTasos Sahanidis <tasos@tasossah.com>
      Link: https://lore.kernel.org/r/20230329032422.170024-1-tasos@tasossah.com
      
      
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      db7d7782
    • Jakob Koschel's avatar
      ice: fix invalid check for empty list in ice_sched_assoc_vsi_to_agg() · 9bc9e444
      Jakob Koschel authored
      [ Upstream commit e9a1cc2e ]
      
      The code implicitly assumes that the list iterator finds a correct
      handle. If 'vsi_handle' is not found the 'old_agg_vsi_info' was
      pointing to an bogus memory location. For safety a separate list
      iterator variable should be used to make the != NULL check on
      'old_agg_vsi_info' correct under any circumstances.
      
      Additionally Linus proposed to avoid any use of the list iterator
      variable after the loop, in the attempt to move the list iterator
      variable declaration into the macro to avoid any potential misuse after
      the loop. Using it in a pointer comparison after the loop is undefined
      behavior and should be omitted if possible [1].
      
      Fixes: 37c59206 ("ice: remove the VSI info from previous agg")
      Link: https://lore.kernel.org/all/CAHk-=wgRr_D8CB-D9Kg-c=EHreAsk5SqXPwr9Y7k9sA6cWXJ6w@mail.gmail.com/
      
       [1]
      Signed-off-by: default avatarJakob Koschel <jkl820.git@gmail.com>
      Tested-by: Arpana Arland <arpanax.arland@intel.com> (A Contingent worker at Intel)
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      9bc9e444
    • Junfeng Guo's avatar
      ice: add profile conflict check for AVF FDIR · d1090005
      Junfeng Guo authored
      [ Upstream commit 29486b6d ]
      
      Add profile conflict check while adding some FDIR rules to avoid
      unexpected flow behavior, rules may have conflict including:
              IPv4 <---> {IPv4_UDP, IPv4_TCP, IPv4_SCTP}
              IPv6 <---> {IPv6_UDP, IPv6_TCP, IPv6_SCTP}
      
      For example, when we create an FDIR rule for IPv4, this rule will work
      on packets including IPv4, IPv4_UDP, IPv4_TCP and IPv4_SCTP. But if we
      then create an FDIR rule for IPv4_UDP and then destroy it, the first
      FDIR rule for IPv4 cannot work on pkt IPv4_UDP then.
      
      To prevent this unexpected behavior, we add restriction in software
      when creating FDIR rules by adding necessary profile conflict check.
      
      Fixes: 1f7ea1cd
      
       ("ice: Enable FDIR Configure for AVF")
      Signed-off-by: default avatarJunfeng Guo <junfeng.guo@intel.com>
      Tested-by: default avatarRafal Romanowski <rafal.romanowski@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      d1090005
    • Brett Creeley's avatar
      ice: Fix ice_cfg_rdma_fltr() to only update relevant fields · 08857388
      Brett Creeley authored
      [ Upstream commit d94dbdc4 ]
      
      The current implementation causes ice_vsi_update() to update all VSI
      fields based on the cached VSI context. This also assumes that the
      ICE_AQ_VSI_PROP_Q_OPT_VALID bit is set. This can cause problems if the
      VSI context is not correctly synced by the driver. Fix this by only
      updating the fields that correspond to ICE_AQ_VSI_PROP_Q_OPT_VALID.
      Also, make sure to save the updated result in the cached VSI context
      on success.
      
      Fixes: 348048e7
      
       ("ice: Implement iidc operations")
      Co-developed-by: default avatarRobert Malz <robertx.malz@intel.com>
      Signed-off-by: default avatarRobert Malz <robertx.malz@intel.com>
      Signed-off-by: default avatarBrett Creeley <brett.creeley@intel.com>
      Signed-off-by: default avatarJesse Brandeburg <jesse.brandeburg@intel.com>
      Reviewed-by: default avatarPiotr Raczynski <piotr.raczynski@intel.com>
      Tested-by: default avatarJakub Andrysiak <jakub.andrysiak@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      08857388
    • Wolfram Sang's avatar
      smsc911x: avoid PHY being resumed when interface is not up · 0b9541ae
      Wolfram Sang authored
      [ Upstream commit f22c993f ]
      
      SMSC911x doesn't need mdiobus suspend/resume, that's why it sets
      'mac_managed_pm'. However, setting it needs to be moved from init to
      probe, so mdiobus PM functions will really never be called (e.g. when
      the interface is not up yet during suspend/resume).
      
      Fixes: 3ce9f2be
      
       ("net: smsc911x: Stop and start PHY during suspend and resume")
      Suggested-by: default avatarHeiner Kallweit <hkallweit1@gmail.com>
      Signed-off-by: default avatarWolfram Sang <wsa+renesas@sang-engineering.com>
      Reviewed-by: default avatarSimon Horman <simon.horman@corigine.com>
      Link: https://lore.kernel.org/r/20230327083138.6044-1-wsa+renesas@sang-engineering.com
      
      
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      0b9541ae
    • Sven Auhagen's avatar
      net: mvpp2: parser fix PPPoE · a921dbbc
      Sven Auhagen authored
      [ Upstream commit 031a416c ]
      
      In PPPoE add all IPv4 header option length to the parser
      and adjust the L3 and L4 offset accordingly.
      Currently the L4 match does not work with PPPoE and
      all packets are matched as L3 IP4 OPT.
      
      Fixes: 3f518509
      
       ("ethernet: Add new driver for Marvell Armada 375 network unit")
      Signed-off-by: default avatarSven Auhagen <sven.auhagen@voleatech.de>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      a921dbbc
    • Sven Auhagen's avatar
      net: mvpp2: parser fix QinQ · 2a4f7442
      Sven Auhagen authored
      [ Upstream commit a587a848 ]
      
      The mvpp2 parser entry for QinQ has the inner and outer VLAN
      in the wrong order.
      Fix the problem by swapping them.
      
      Fixes: 3f518509
      
       ("ethernet: Add new driver for Marvell Armada 375 network unit")
      Signed-off-by: default avatarSven Auhagen <sven.auhagen@voleatech.de>
      Reviewed-by: default avatarMarcin Wojtas <mw@semihalf.com>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      2a4f7442
    • Sven Auhagen's avatar
      net: mvpp2: classifier flow fix fragmentation flags · 5718b58c
      Sven Auhagen authored
      [ Upstream commit 9a251cae ]
      
      Add missing IP Fragmentation Flag.
      
      Fixes: f9358e12
      
       ("net: mvpp2: split ingress traffic into multiple flows")
      Signed-off-by: default avatarSven Auhagen <sven.auhagen@voleatech.de>
      Reviewed-by: default avatarMarcin Wojtas <mw@semihalf.com>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      5718b58c
    • Alyssa Ross's avatar
      loop: LOOP_CONFIGURE: send uevents for partitions · bee9ca40
      Alyssa Ross authored
      [ Upstream commit bb430b69
      
       ]
      
      LOOP_CONFIGURE is, as far as I understand it, supposed to be a way to
      combine LOOP_SET_FD and LOOP_SET_STATUS64 into a single syscall.  When
      using LOOP_SET_FD+LOOP_SET_STATUS64, a single uevent would be sent for
      each partition found on the loop device after the second ioctl(), but
      when using LOOP_CONFIGURE, no such uevent was being sent.
      
      In the old setup, uevents are disabled for LOOP_SET_FD, but not for
      LOOP_SET_STATUS64.  This makes sense, as it prevents uevents being
      sent for a partially configured device during LOOP_SET_FD - they're
      only sent at the end of LOOP_SET_STATUS64.  But for LOOP_CONFIGURE,
      uevents were disabled for the entire operation, so that final
      notification was never issued.  To fix this, reduce the critical
      section to exclude the loop_reread_partitions() call, which causes
      the uevents to be issued, to after uevents are re-enabled, matching
      the behaviour of the LOOP_SET_FD+LOOP_SET_STATUS64 combination.
      
      I noticed this because Busybox's losetup program recently changed from
      using LOOP_SET_FD+LOOP_SET_STATUS64 to LOOP_CONFIGURE, and this broke
      my setup, for which I want a notification from the kernel any time a
      new partition becomes available.
      
      Signed-off-by: default avatarAlyssa Ross <hi@alyssa.is>
      [hch: reduced the critical section]
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Fixes: 3448914e ("loop: Add LOOP_CONFIGURE ioctl")
      Link: https://lore.kernel.org/r/20230320125430.55367-1-hch@lst.de
      
      
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      bee9ca40
    • Rafael J. Wysocki's avatar
      ACPI: bus: Rework system-level device notification handling · b7707176
      Rafael J. Wysocki authored
      [ Upstream commit c56610a8 ]
      
      For ACPI drivers that provide a ->notify() callback and set
      ACPI_DRIVER_ALL_NOTIFY_EVENTS in their flags, that callback can be
      invoked while either the ->add() or the ->remove() callback is running
      without any synchronization at the bus type level which is counter to
      the common-sense expectation that notification handling should only be
      enabled when the driver is actually bound to the device.  As a result,
      if the driver is not careful enough, it's ->notify() callback may crash
      when it is invoked too early or too late [1].
      
      This issue has been amplified by commit d6fb6ee1 ("ACPI: bus: Drop
      driver member of struct acpi_device") that made acpi_bus_notify() check
      for the presence of the driver and its ->notify() callback directly
      instead of using an extra driver pointer that was only set and cleared
      by the bus type code, but it was present before that commit although
      it was harder to reproduce then.
      
      It can be addressed by using the observation that
      acpi_device_install_notify_handler() can be modified to install the
      handler for all types of events when ACPI_DRIVER_ALL_NOTIFY_EVENTS is
      set in the driver flags, in which case acpi_bus_notify() will not need
      to invoke the driver's ->notify() callback any more and that callback
      will only be invoked after acpi_device_install_notify_handler() has run
      and before acpi_device_remove_notify_handler() runs, which implies the
      correct ordering with respect to the other ACPI driver callbacks.
      
      Modify the code accordingly and while at it, drop two redundant local
      variables from acpi_bus_notify() and turn its description comment into
      a proper kerneldoc one.
      
      Fixes: d6fb6ee1 ("ACPI: bus: Drop driver member of struct acpi_device")
      Link: https://lore.kernel.org/linux-acpi/9f6cba7a8a57e5a687c934e8e406e28c.squirrel@mail.panix.com
      
       # [1]
      Reported-by: default avatarPierre Asselin <pa@panix.com>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Tested-by: default avatarPierre Asselin <pa@panix.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      b7707176
    • Tony Krowiak's avatar
      s390/vfio-ap: fix memory leak in vfio_ap device driver · 6a40fda1
      Tony Krowiak authored
      [ Upstream commit 8f8cf767 ]
      
      The device release callback function invoked to release the matrix device
      uses the dev_get_drvdata(device *dev) function to retrieve the
      pointer to the vfio_matrix_dev object in order to free its storage. The
      problem is, this object is not stored as drvdata with the device; since the
      kfree function will accept a NULL pointer, the memory for the
      vfio_matrix_dev object is never freed.
      
      Since the device being released is contained within the vfio_matrix_dev
      object, the container_of macro will be used to retrieve its pointer.
      
      Fixes: 1fde5734
      
       ("s390: vfio-ap: base implementation of VFIO AP device driver")
      Signed-off-by: default avatarTony Krowiak <akrowiak@linux.ibm.com>
      Reviewed-by: default avatarHarald Freudenberger <freude@linux.ibm.com>
      Link: https://lore.kernel.org/r/20230320150447.34557-1-akrowiak@linux.ibm.com
      
      
      Signed-off-by: default avatarHeiko Carstens <hca@linux.ibm.com>
      Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      6a40fda1