Skip to content
  1. Jan 14, 2023
    • Eric Biggers's avatar
      ext4: disable fast-commit of encrypted dir operations · d9ff5ad2
      Eric Biggers authored
      commit 0fbcb525 upstream.
      
      fast-commit of create, link, and unlink operations in encrypted
      directories is completely broken because the unencrypted filenames are
      being written to the fast-commit journal instead of the encrypted
      filenames.  These operations can't be replayed, as encryption keys
      aren't present at journal replay time.  It is also an information leak.
      
      Until if/when we can get this working properly, make encrypted directory
      operations ineligible for fast-commit.
      
      Note that fast-commit operations on encrypted regular files continue to
      be allowed, as they seem to work.
      
      Fixes: aa75f4d3
      
       ("ext4: main fast-commit commit path")
      Cc: <stable@vger.kernel.org> # v5.10+
      Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
      Link: https://lore.kernel.org/r/20221106224841.279231-2-ebiggers@kernel.org
      
      
      Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d9ff5ad2
    • Helge Deller's avatar
      parisc: Align parisc MADV_XXX constants with all other architectures · 5b700b9c
      Helge Deller authored
      commit 71bdea6f
      
       upstream.
      
      Adjust some MADV_XXX constants to be in sync what their values are on
      all other platforms. There is currently no reason to have an own
      numbering on parisc, but it requires workarounds in many userspace
      sources (e.g. glibc, qemu, ...) - which are often forgotten and thus
      introduce bugs and different behaviour on parisc.
      
      A wrapper avoids an ABI breakage for existing userspace applications by
      translating any old values to the new ones, so this change allows us to
      move over all programs to the new ABI over time.
      
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5b700b9c
    • Harshit Mogalapalli's avatar
      io_uring: Fix unsigned 'res' comparison with zero in io_fixup_rw_res() · 07b3672c
      Harshit Mogalapalli authored
      Smatch warning: io_fixup_rw_res() warn:
      	unsigned 'res' is never less than zero.
      
      Change type of 'res' from unsigned to long.
      
      Fixes: d6b7efc7
      
       ("io_uring/rw: fix error'ed retry return values")
      Signed-off-by: default avatarHarshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      07b3672c
    • Ard Biesheuvel's avatar
      efi: random: combine bootloader provided RNG seed with RNG protocol output · b57d7b1d
      Ard Biesheuvel authored
      commit 196dff27
      
       upstream.
      
      Instead of blindly creating the EFI random seed configuration table if
      the RNG protocol is implemented and works, check whether such a EFI
      configuration table was provided by an earlier boot stage and if so,
      concatenate the existing and the new seeds, leaving it up to the core
      code to mix it in and credit it the way it sees fit.
      
      This can be used for, e.g., systemd-boot, to pass an additional seed to
      Linux in a way that can be consumed by the kernel very early. In that
      case, the following definitions should be used to pass the seed to the
      EFI stub:
      
      struct linux_efi_random_seed {
            u32     size; // of the 'seed' array in bytes
            u8      seed[];
      };
      
      The memory for the struct must be allocated as EFI_ACPI_RECLAIM_MEMORY
      pool memory, and the address of the struct in memory should be installed
      as a EFI configuration table using the following GUID:
      
      LINUX_EFI_RANDOM_SEED_TABLE_GUID        1ce1e5bc-7ceb-42f2-81e5-8aadf180f57b
      
      Note that doing so is safe even on kernels that were built without this
      patch applied, but the seed will simply be overwritten with a seed
      derived from the EFI RNG protocol, if available. The recommended seed
      size is 32 bytes, and seeds larger than 512 bytes are considered
      corrupted and ignored entirely.
      
      In order to preserve forward secrecy, seeds from previous bootloaders
      are memzero'd out, and in order to preserve memory, those older seeds
      are also freed from memory. Freeing from memory without first memzeroing
      is not safe to do, as it's possible that nothing else will ever
      overwrite those pages used by EFI.
      
      Reviewed-by: default avatarJason A. Donenfeld <Jason@zx2c4.com>
      [ardb: incorporate Jason's followup changes to extend the maximum seed
             size on the consumer end, memzero() it and drop a needless printk]
      Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
      Signed-off-by: default avatarJason A. Donenfeld <Jason@zx2c4.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b57d7b1d
    • Jan Kara's avatar
      mbcache: Avoid nesting of cache->c_list_lock under bit locks · da20f56a
      Jan Kara authored
      commit 5fc4cbd9 upstream.
      
      Commit 307af6c8 ("mbcache: automatically delete entries from cache
      on freeing") started nesting cache->c_list_lock under the bit locks
      protecting hash buckets of the mbcache hash table in
      mb_cache_entry_create(). This causes problems for real-time kernels
      because there spinlocks are sleeping locks while bitlocks stay atomic.
      Luckily the nesting is easy to avoid by holding entry reference until
      the entry is added to the LRU list. This makes sure we cannot race with
      entry deletion.
      
      Cc: stable@kernel.org
      Fixes: 307af6c8
      
       ("mbcache: automatically delete entries from cache on freeing")
      Reported-by: default avatarMike Galbraith <efault@gmx.de>
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      Link: https://lore.kernel.org/r/20220908091032.10513-1-jack@suse.cz
      
      
      Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      da20f56a
    • Linus Torvalds's avatar
      hfs/hfsplus: avoid WARN_ON() for sanity check, use proper error handling · be01f35e
      Linus Torvalds authored
      commit cb7a95af upstream.
      
      Commit 55d1cbbb
      
       ("hfs/hfsplus: use WARN_ON for sanity check") fixed
      a build warning by turning a comment into a WARN_ON(), but it turns out
      that syzbot then complains because it can trigger said warning with a
      corrupted hfs image.
      
      The warning actually does warn about a bad situation, but we are much
      better off just handling it as the error it is.  So rather than warn
      about us doing bad things, stop doing the bad things and return -EIO.
      
      While at it, also fix a memory leak that was introduced by an earlier
      fix for a similar syzbot warning situation, and add a check for one case
      that historically wasn't handled at all (ie neither comment nor
      subsequent WARN_ON).
      
      Reported-by: default avatar <syzbot+7bb7cd3595533513a9e7@syzkaller.appspotmail.com>
      Fixes: 55d1cbbb ("hfs/hfsplus: use WARN_ON for sanity check")
      Fixes: 8d824e69 ("hfs: fix OOB Read in __hfs_brec_find")
      Link: https://lore.kernel.org/lkml/000000000000dbce4e05f170f289@google.com/
      
      
      Tested-by: default avatarMichael Schmitz <schmitzmic@gmail.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: Viacheslav Dubeyko <slava@dubeyko.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      be01f35e
    • Arnd Bergmann's avatar
      hfs/hfsplus: use WARN_ON for sanity check · 1f881d92
      Arnd Bergmann authored
      commit 55d1cbbb upstream.
      
      gcc warns about a couple of instances in which a sanity check exists but
      the author wasn't sure how to react to it failing, which makes it look
      like a possible bug:
      
        fs/hfsplus/inode.c: In function 'hfsplus_cat_read_inode':
        fs/hfsplus/inode.c:503:37: error: suggest braces around empty body in an 'if' statement [-Werror=empty-body]
          503 |                         /* panic? */;
              |                                     ^
        fs/hfsplus/inode.c:524:37: error: suggest braces around empty body in an 'if' statement [-Werror=empty-body]
          524 |                         /* panic? */;
              |                                     ^
        fs/hfsplus/inode.c: In function 'hfsplus_cat_write_inode':
        fs/hfsplus/inode.c:582:37: error: suggest braces around empty body in an 'if' statement [-Werror=empty-body]
          582 |                         /* panic? */;
              |                                     ^
        fs/hfsplus/inode.c:608:37: error: suggest braces around empty body in an 'if' statement [-Werror=empty-body]
          608 |                         /* panic? */;
              |                                     ^
        fs/hfs/inode.c: In function 'hfs_write_inode':
        fs/hfs/inode.c:464:37: error: suggest braces around empty body in an 'if' statement [-Werror=empty-body]
          464 |                         /* panic? */;
              |                                     ^
        fs/hfs/inode.c:485:37: error: suggest braces around empty body in an 'if' statement [-Werror=empty-body]
          485 |                         /* panic? */;
              |                                     ^
      
      panic() is probably not the correct choice here, but a WARN_ON
      seems appropriate and avoids the compile-time warning.
      
      Link: https://lkml.kernel.org/r/20210927102149.1809384-1-arnd@kernel.org
      Link: https://lore.kernel.org/all/20210322223249.2632268-1-arnd@kernel.org/
      
      
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Reviewed-by: default avatarChristian Brauner <christian.brauner@ubuntu.com>
      Cc: Alexander Viro <viro@zeniv.linux.org.uk>
      Cc: Christian Brauner <christian.brauner@ubuntu.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Jan Kara <jack@suse.cz>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1f881d92
    • Muhammad Usama Anjum's avatar
      selftests: set the BUILD variable to absolute path · 434909ed
      Muhammad Usama Anjum authored
      commit 5ad51ab6
      
       upstream.
      
      The build of kselftests fails if relative path is specified through
      KBUILD_OUTPUT or O=<path> method. BUILD variable is used to determine
      the path of the output objects. When make is run from other directories
      with relative paths, the exact path of the build objects is ambiguous
      and build fails.
      
      	make[1]: Entering directory '/home/usama/repos/kernel/linux_mainline2/tools/testing/selftests/alsa'
      	gcc     mixer-test.c -L/usr/lib/x86_64-linux-gnu -lasound  -o build/kselftest/alsa/mixer-test
      	/usr/bin/ld: cannot open output file build/kselftest/alsa/mixer-test
      
      Set the BUILD variable to the absolute path of the output directory.
      Make the logic readable and easy to follow. Use spaces instead of tabs
      for indentation as if with tab indentation is considered recipe in make.
      
      Signed-off-by: default avatarMuhammad Usama Anjum <usama.anjum@collabora.com>
      Signed-off-by: default avatarShuah Khan <skhan@linuxfoundation.org>
      Signed-off-by: default avatarTyler Hicks (Microsoft) <code@tyhicks.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      434909ed
    • Eric Biggers's avatar
      ext4: don't allow journal inode to have encrypt flag · a41d63f2
      Eric Biggers authored
      commit 105c78e1
      
       upstream.
      
      Mounting a filesystem whose journal inode has the encrypt flag causes a
      NULL dereference in fscrypt_limit_io_blocks() when the 'inlinecrypt'
      mount option is used.
      
      The problem is that when jbd2_journal_init_inode() calls bmap(), it
      eventually finds its way into ext4_iomap_begin(), which calls
      fscrypt_limit_io_blocks().  fscrypt_limit_io_blocks() requires that if
      the inode is encrypted, then its encryption key must already be set up.
      That's not the case here, since the journal inode is never "opened" like
      a normal file would be.  Hence the crash.
      
      A reproducer is:
      
          mkfs.ext4 -F /dev/vdb
          debugfs -w /dev/vdb -R "set_inode_field <8> flags 0x80808"
          mount /dev/vdb /mnt -o inlinecrypt
      
      To fix this, make ext4 consider journal inodes with the encrypt flag to
      be invalid.  (Note, maybe other flags should be rejected on the journal
      inode too.  For now, this is just the minimal fix for the above issue.)
      
      I've marked this as fixing the commit that introduced the call to
      fscrypt_limit_io_blocks(), since that's what made an actual crash start
      being possible.  But this fix could be applied to any version of ext4
      that supports the encrypt feature.
      
      Reported-by: default avatar <syzbot+ba9dac45bc76c490b7c3@syzkaller.appspotmail.com>
      Fixes: 38ea50da
      
       ("ext4: support direct I/O with fscrypt using blk-crypto")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
      Link: https://lore.kernel.org/r/20221102053312.189962-1-ebiggers@kernel.org
      
      
      Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
      Cc: stable@kernel.org
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a41d63f2
    • Zhenyu Wang's avatar
      drm/i915/gvt: fix vgpu debugfs clean in remove · af90f8b3
      Zhenyu Wang authored
      commit 704f3384
      
       upstream.
      
      Check carefully on root debugfs available when destroying vgpu,
      e.g in remove case drm minor's debugfs root might already be destroyed,
      which led to kernel oops like below.
      
      Console: switching to colour dummy device 80x25
      i915 0000:00:02.0: MDEV: Unregistering
      intel_vgpu_mdev b1338b2d-a709-4c23-b766-cc436c36cdf0: Removing from iommu group 14
      BUG: kernel NULL pointer dereference, address: 0000000000000150
      PGD 0 P4D 0
      Oops: 0000 [#1] PREEMPT SMP
      CPU: 3 PID: 1046 Comm: driverctl Not tainted 6.1.0-rc2+ #6
      Hardware name: HP HP ProDesk 600 G3 MT/829D, BIOS P02 Ver. 02.44 09/13/2022
      RIP: 0010:__lock_acquire+0x5e2/0x1f90
      Code: 87 ad 09 00 00 39 05 e1 1e cc 02 0f 82 f1 09 00 00 ba 01 00 00 00 48 83 c4 48 89 d0 5b 5d 41 5c 41 5d 41 5e 41 5f c3 45 31 ff <48> 81 3f 60 9e c2 b6 45 0f 45 f8 83 fe 01 0f 87 55 fa ff ff 89 f0
      RSP: 0018:ffff9f770274f948 EFLAGS: 00010046
      RAX: 0000000000000003 RBX: 0000000000000000 RCX: 0000000000000000
      RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000150
      RBP: 0000000000000000 R08: 0000000000000001 R09: 0000000000000000
      R10: ffff8895d1173300 R11: 0000000000000001 R12: 0000000000000000
      R13: 0000000000000150 R14: 0000000000000000 R15: 0000000000000000
      FS:  00007fc9b2ba0740(0000) GS:ffff889cdfcc0000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 0000000000000150 CR3: 000000010fd93005 CR4: 00000000003706e0
      DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      Call Trace:
       <TASK>
       lock_acquire+0xbf/0x2b0
       ? simple_recursive_removal+0xa5/0x2b0
       ? lock_release+0x13d/0x2d0
       down_write+0x2a/0xd0
       ? simple_recursive_removal+0xa5/0x2b0
       simple_recursive_removal+0xa5/0x2b0
       ? start_creating.part.0+0x110/0x110
       ? _raw_spin_unlock+0x29/0x40
       debugfs_remove+0x40/0x60
       intel_gvt_debugfs_remove_vgpu+0x15/0x30 [kvmgt]
       intel_gvt_destroy_vgpu+0x60/0x100 [kvmgt]
       intel_vgpu_release_dev+0xe/0x20 [kvmgt]
       device_release+0x30/0x80
       kobject_put+0x79/0x1b0
       device_release_driver_internal+0x1b8/0x230
       bus_remove_device+0xec/0x160
       device_del+0x189/0x400
       ? up_write+0x9c/0x1b0
       ? mdev_device_remove_common+0x60/0x60 [mdev]
       mdev_device_remove_common+0x22/0x60 [mdev]
       mdev_device_remove_cb+0x17/0x20 [mdev]
       device_for_each_child+0x56/0x80
       mdev_unregister_parent+0x5a/0x81 [mdev]
       intel_gvt_clean_device+0x2d/0xe0 [kvmgt]
       intel_gvt_driver_remove+0x2e/0xb0 [i915]
       i915_driver_remove+0xac/0x100 [i915]
       i915_pci_remove+0x1a/0x30 [i915]
       pci_device_remove+0x31/0xa0
       device_release_driver_internal+0x1b8/0x230
       unbind_store+0xd8/0x100
       kernfs_fop_write_iter+0x156/0x210
       vfs_write+0x236/0x4a0
       ksys_write+0x61/0xd0
       do_syscall_64+0x55/0x80
       ? find_held_lock+0x2b/0x80
       ? lock_release+0x13d/0x2d0
       ? up_read+0x17/0x20
       ? lock_is_held_type+0xe3/0x140
       ? asm_exc_page_fault+0x22/0x30
       ? lockdep_hardirqs_on+0x7d/0x100
       entry_SYSCALL_64_after_hwframe+0x46/0xb0
      RIP: 0033:0x7fc9b2c9e0c4
      Code: 15 71 7d 0d 00 f7 d8 64 89 02 48 c7 c0 ff ff ff ff eb b7 0f 1f 00 f3 0f 1e fa 80 3d 3d 05 0e 00 00 74 13 b8 01 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 54 c3 0f 1f 00 48 83 ec 28 48 89 54 24 18 48
      RSP: 002b:00007ffec29c81c8 EFLAGS: 00000202 ORIG_RAX: 0000000000000001
      RAX: ffffffffffffffda RBX: 000000000000000d RCX: 00007fc9b2c9e0c4
      RDX: 000000000000000d RSI: 0000559f8b5f48a0 RDI: 0000000000000001
      RBP: 0000559f8b5f48a0 R08: 0000559f8b5f3540 R09: 00007fc9b2d76d30
      R10: 0000000000000000 R11: 0000000000000202 R12: 000000000000000d
      R13: 00007fc9b2d77780 R14: 000000000000000d R15: 00007fc9b2d72a00
       </TASK>
      Modules linked in: sunrpc intel_rapl_msr intel_rapl_common intel_pmc_core_pltdrv intel_pmc_core intel_tcc_cooling x86_pkg_temp_thermal intel_powerclamp coretemp kvm_intel ee1004 igbvf rapl vfat fat intel_cstate intel_uncore pktcdvd i2c_i801 pcspkr wmi_bmof i2c_smbus acpi_pad vfio_pci vfio_pci_core vfio_virqfd zram fuse dm_multipath kvmgt mdev vfio_iommu_type1 vfio kvm irqbypass i915 nvme e1000e igb nvme_core crct10dif_pclmul crc32_pclmul crc32c_intel polyval_clmulni polyval_generic serio_raw ghash_clmulni_intel sha512_ssse3 dca drm_buddy intel_gtt video wmi drm_display_helper ttm
      CR2: 0000000000000150
      ---[ end trace 0000000000000000 ]---
      
      Cc: Wang Zhi <zhi.a.wang@intel.com>
      Cc: He Yu <yu.he@intel.com>
      Cc: Alex Williamson <alex.williamson@redhat.com>
      Cc: stable@vger.kernel.org
      Reviewed-by: default avatarZhi Wang <zhi.a.wang@intel.com>
      Tested-by: default avatarYu He <yu.he@intel.com>
      Fixes: bc7b0be3
      
       ("drm/i915/gvt: Add basic debugfs infrastructure")
      Signed-off-by: default avatarZhenyu Wang <zhenyuw@linux.intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/20221219140357.769557-2-zhenyuw@linux.intel.com
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      af90f8b3
    • Zhenyu Wang's avatar
      drm/i915/gvt: fix gvt debugfs destroy · bb7c7b2c
      Zhenyu Wang authored
      commit c4b850d1
      
       upstream.
      
      When gvt debug fs is destroyed, need to have a sane check if drm
      minor's debugfs root is still available or not, otherwise in case like
      device remove through unbinding, drm minor's debugfs directory has
      already been removed, then intel_gvt_debugfs_clean() would act upon
      dangling pointer like below oops.
      
      i915 0000:00:02.0: Direct firmware load for i915/gvt/vid_0x8086_did_0x1926_rid_0x0a.golden_hw_state failed with error -2
      i915 0000:00:02.0: MDEV: Registered
      Console: switching to colour dummy device 80x25
      i915 0000:00:02.0: MDEV: Unregistering
      BUG: kernel NULL pointer dereference, address: 00000000000000a0
      PGD 0 P4D 0
      Oops: 0002 [#1] PREEMPT SMP PTI
      CPU: 2 PID: 2486 Comm: gfx-unbind.sh Tainted: G          I        6.1.0-rc8+ #15
      Hardware name: Dell Inc. XPS 13 9350/0JXC1H, BIOS 1.13.0 02/10/2020
      RIP: 0010:down_write+0x1f/0x90
      Code: 1d ff ff 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 53 48 89 fb e8 62 c0 ff ff bf 01 00 00 00 e8 28 5e 31 ff 31 c0 ba 01 00 00 00 <f0> 48 0f b1 13 75 33 65 48 8b 04 25 c0 bd 01 00 48 89 43 08 bf 01
      RSP: 0018:ffff9eb3036ffcc8 EFLAGS: 00010246
      RAX: 0000000000000000 RBX: 00000000000000a0 RCX: ffffff8100000000
      RDX: 0000000000000001 RSI: 0000000000000064 RDI: ffffffffa48787a8
      RBP: ffff9eb3036ffd30 R08: ffffeb1fc45a0608 R09: ffffeb1fc45a05c0
      R10: 0000000000000002 R11: 0000000000000000 R12: 0000000000000000
      R13: ffff91acc33fa328 R14: ffff91acc033f080 R15: ffff91acced533e0
      FS:  00007f6947bba740(0000) GS:ffff91ae36d00000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 00000000000000a0 CR3: 00000001133a2002 CR4: 00000000003706e0
      Call Trace:
       <TASK>
       simple_recursive_removal+0x9f/0x2a0
       ? start_creating.part.0+0x120/0x120
       ? _raw_spin_lock+0x13/0x40
       debugfs_remove+0x40/0x60
       intel_gvt_debugfs_clean+0x15/0x30 [kvmgt]
       intel_gvt_clean_device+0x49/0xe0 [kvmgt]
       intel_gvt_driver_remove+0x2f/0xb0
       i915_driver_remove+0xa4/0xf0
       i915_pci_remove+0x1a/0x30
       pci_device_remove+0x33/0xa0
       device_release_driver_internal+0x1b2/0x230
       unbind_store+0xe0/0x110
       kernfs_fop_write_iter+0x11b/0x1f0
       vfs_write+0x203/0x3d0
       ksys_write+0x63/0xe0
       do_syscall_64+0x37/0x90
       entry_SYSCALL_64_after_hwframe+0x63/0xcd
      RIP: 0033:0x7f6947cb5190
      Code: 40 00 48 8b 15 71 9c 0d 00 f7 d8 64 89 02 48 c7 c0 ff ff ff ff eb b7 0f 1f 00 80 3d 51 24 0e 00 00 74 17 b8 01 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 58 c3 0f 1f 80 00 00 00 00 48 83 ec 28 48 89
      RSP: 002b:00007ffcbac45a28 EFLAGS: 00000202 ORIG_RAX: 0000000000000001
      RAX: ffffffffffffffda RBX: 000000000000000d RCX: 00007f6947cb5190
      RDX: 000000000000000d RSI: 0000555e35c866a0 RDI: 0000000000000001
      RBP: 0000555e35c866a0 R08: 0000000000000002 R09: 0000555e358cb97c
      R10: 0000000000000000 R11: 0000000000000202 R12: 0000000000000001
      R13: 000000000000000d R14: 0000000000000000 R15: 0000555e358cb8e0
       </TASK>
      Modules linked in: kvmgt
      CR2: 00000000000000a0
      ---[ end trace 0000000000000000 ]---
      
      Cc: Wang, Zhi <zhi.a.wang@intel.com>
      Cc: He, Yu <yu.he@intel.com>
      Cc: stable@vger.kernel.org
      Reviewed-by: default avatarZhi Wang <zhi.a.wang@intel.com>
      Fixes: bc7b0be3
      
       ("drm/i915/gvt: Add basic debugfs infrastructure")
      Signed-off-by: default avatarZhenyu Wang <zhenyuw@linux.intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/20221219140357.769557-1-zhenyuw@linux.intel.com
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      bb7c7b2c
    • Ben Dooks's avatar
      riscv: uaccess: fix type of 0 variable on error in get_user() · bc847857
      Ben Dooks authored
      commit b9b916ae
      
       upstream.
      
      If the get_user(x, ptr) has x as a pointer, then the setting
      of (x) = 0 is going to produce the following sparse warning,
      so fix this by forcing the type of 'x' when access_ok() fails.
      
      fs/aio.c:2073:21: warning: Using plain integer as NULL pointer
      
      Signed-off-by: default avatarBen Dooks <ben-linux@fluff.org>
      Reviewed-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
      Link: https://lore.kernel.org/r/20221229170545.718264-1-ben-linux@fluff.org
      
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      bc847857
    • Paul Menzel's avatar
      fbdev: matroxfb: G200eW: Increase max memory from 1 MB to 16 MB · f64e56fb
      Paul Menzel authored
      commit f685dd7a upstream.
      
      Commit 62d89a7d ("video: fbdev: matroxfb: set maxvram of vbG200eW to
      the same as vbG200 to avoid black screen") accidently decreases the
      maximum memory size for the Matrox G200eW (102b:0532) from 8 MB to 1 MB
      by missing one zero. This caused the driver initialization to fail with
      the messages below, as the minimum required VRAM size is 2 MB:
      
           [    9.436420] matroxfb: Matrox MGA-G200eW (PCI) detected
           [    9.444502] matroxfb: cannot determine memory size
           [    9.449316] matroxfb: probe of 0000:0a:03.0 failed with error -1
      
      So, add the missing 0 to make it the intended 16 MB. Successfully tested on
      the Dell PowerEdge R910/0KYD3D, BIOS 2.10.0 08/29/2013, that the warning is
      gone.
      
      While at it, add a leading 0 to the maxdisplayable entry, so it’s aligned
      properly. The value could probably also be increased from 8 MB to 16 MB, as
      the G200 uses the same values, but I have not checked any datasheet.
      
      Note, matroxfb is obsolete and superseded by the maintained DRM driver
      mga200, which is used by default on most systems where both drivers are
      available. Therefore, on most systems it was only a cosmetic issue.
      
      Fixes: 62d89a7d ("video: fbdev: matroxfb: set maxvram of vbG200eW to the same as vbG200 to avoid black screen")
      Link: https://lore.kernel.org/linux-fbdev/972999d3-b75d-5680-fcef-6e6905c52ac5@suse.de/T/#mb6953a9995ebd18acc8552f99d6db39787aec775
      
      
      Cc: it+linux-fbdev@molgen.mpg.de
      Cc: Z. Liu <liuzx@knownsec.com>
      Cc: Rich Felker <dalias@libc.org>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarPaul Menzel <pmenzel@molgen.mpg.de>
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f64e56fb
    • Jeff Layton's avatar
      nfsd: fix handling of readdir in v4root vs. mount upcall timeout · d0c46b55
      Jeff Layton authored
      commit cad85337 upstream.
      
      If v4 READDIR operation hits a mountpoint and gets back an error,
      then it will include that entry in the reply and set RDATTR_ERROR for it
      to the error.
      
      That's fine for "normal" exported filesystems, but on the v4root, we
      need to be more careful to only expose the existence of dentries that
      lead to exports.
      
      If the mountd upcall times out while checking to see whether a
      mountpoint on the v4root is exported, then we have no recourse other
      than to fail the whole operation.
      
      Cc: Steve Dickson <steved@redhat.com>
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=216777
      
      
      Reported-by: default avatarJianHong Yin <yin-jianhong@163.com>
      Signed-off-by: default avatarJeff Layton <jlayton@kernel.org>
      Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d0c46b55
    • Rodrigo Branco's avatar
      x86/bugs: Flush IBP in ib_prctl_set() · 67e39c4f
      Rodrigo Branco authored
      commit a664ec91
      
       upstream.
      
      We missed the window between the TIF flag update and the next reschedule.
      
      Signed-off-by: default avatarRodrigo Branco <bsdaemon@google.com>
      Reviewed-by: default avatarBorislav Petkov (AMD) <bp@alien8.de>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      67e39c4f
    • Yanjun Zhang's avatar
      nvme: fix multipath crash caused by flush request when blktrace is enabled · f13301a6
      Yanjun Zhang authored
      [ Upstream commit 3659fb5a
      
       ]
      
      The flush request initialized by blk_kick_flush has NULL bio,
      and it may be dealt with nvme_end_req during io completion.
      When blktrace is enabled, nvme_trace_bio_complete with multipath
      activated trying to access NULL pointer bio from flush request
      results in the following crash:
      
      [ 2517.831677] BUG: kernel NULL pointer dereference, address: 000000000000001a
      [ 2517.835213] #PF: supervisor read access in kernel mode
      [ 2517.838724] #PF: error_code(0x0000) - not-present page
      [ 2517.842222] PGD 7b2d51067 P4D 0
      [ 2517.845684] Oops: 0000 [#1] SMP NOPTI
      [ 2517.849125] CPU: 2 PID: 732 Comm: kworker/2:1H Kdump: loaded Tainted: G S                5.15.67-0.cl9.x86_64 #1
      [ 2517.852723] Hardware name: XFUSION 2288H V6/BC13MBSBC, BIOS 1.13 07/27/2022
      [ 2517.856358] Workqueue: nvme_tcp_wq nvme_tcp_io_work [nvme_tcp]
      [ 2517.859993] RIP: 0010:blk_add_trace_bio_complete+0x6/0x30
      [ 2517.863628] Code: 1f 44 00 00 48 8b 46 08 31 c9 ba 04 00 10 00 48 8b 80 50 03 00 00 48 8b 78 50 e9 e5 fe ff ff 0f 1f 44 00 00 41 54 49 89 f4 55 <0f> b6 7a 1a 48 89 d5 e8 3e 1c 2b 00 48 89 ee 4c 89 e7 5d 89 c1 ba
      [ 2517.871269] RSP: 0018:ff7f6a008d9dbcd0 EFLAGS: 00010286
      [ 2517.875081] RAX: ff3d5b4be00b1d50 RBX: 0000000002040002 RCX: ff3d5b0a270f2000
      [ 2517.878966] RDX: 0000000000000000 RSI: ff3d5b0b021fb9f8 RDI: 0000000000000000
      [ 2517.882849] RBP: ff3d5b0b96a6fa00 R08: 0000000000000001 R09: 0000000000000000
      [ 2517.886718] R10: 000000000000000c R11: 000000000000000c R12: ff3d5b0b021fb9f8
      [ 2517.890575] R13: 0000000002000000 R14: ff3d5b0b021fb1b0 R15: 0000000000000018
      [ 2517.894434] FS:  0000000000000000(0000) GS:ff3d5b42bfc80000(0000) knlGS:0000000000000000
      [ 2517.898299] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [ 2517.902157] CR2: 000000000000001a CR3: 00000004f023e005 CR4: 0000000000771ee0
      [ 2517.906053] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      [ 2517.909930] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      [ 2517.913761] PKRU: 55555554
      [ 2517.917558] Call Trace:
      [ 2517.921294]  <TASK>
      [ 2517.924982]  nvme_complete_rq+0x1c3/0x1e0 [nvme_core]
      [ 2517.928715]  nvme_tcp_recv_pdu+0x4d7/0x540 [nvme_tcp]
      [ 2517.932442]  nvme_tcp_recv_skb+0x4f/0x240 [nvme_tcp]
      [ 2517.936137]  ? nvme_tcp_recv_pdu+0x540/0x540 [nvme_tcp]
      [ 2517.939830]  tcp_read_sock+0x9c/0x260
      [ 2517.943486]  nvme_tcp_try_recv+0x65/0xa0 [nvme_tcp]
      [ 2517.947173]  nvme_tcp_io_work+0x64/0x90 [nvme_tcp]
      [ 2517.950834]  process_one_work+0x1e8/0x390
      [ 2517.954473]  worker_thread+0x53/0x3c0
      [ 2517.958069]  ? process_one_work+0x390/0x390
      [ 2517.961655]  kthread+0x10c/0x130
      [ 2517.965211]  ? set_kthread_struct+0x40/0x40
      [ 2517.968760]  ret_from_fork+0x1f/0x30
      [ 2517.972285]  </TASK>
      
      To avoid this situation, add a NULL check for req->bio before
      calling trace_block_bio_complete.
      
      Signed-off-by: default avatarYanjun Zhang <zhangyanjun@cestc.cn>
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      f13301a6
    • Hans de Goede's avatar
      ASoC: Intel: bytcr_rt5640: Add quirk for the Advantech MICA-071 tablet · 3f257a98
      Hans de Goede authored
      [ Upstream commit a1dec9d7
      
       ]
      
      The Advantech MICA-071 tablet deviates from the defaults for
      a non CR Bay Trail based tablet in several ways:
      
      1. It uses an analog MIC on IN3 rather then using DMIC1
      2. It only has 1 speaker
      3. It needs the OVCD current threshold to be set to 1500uA instead of
         the default 2000uA to reliable differentiate between headphones vs
         headsets
      
      Add a quirk with these settings for this tablet.
      
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Acked-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
      Link: https://lore.kernel.org/r/20221213123246.11226-1-hdegoede@redhat.com
      
      
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      3f257a98
    • Jan Kara's avatar
      udf: Fix extension of the last extent in the file · 6df376e2
      Jan Kara authored
      [ Upstream commit 83c7423d ]
      
      When extending the last extent in the file within the last block, we
      wrongly computed the length of the last extent. This is mostly a
      cosmetical problem since the extent does not contain any data and the
      length will be fixed up by following operations but still.
      
      Fixes: 1f3868f0
      
       ("udf: Fix extending file within last block")
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      6df376e2
    • Zhengchao Shao's avatar
      caif: fix memory leak in cfctrl_linkup_request() · 84b2cc7b
      Zhengchao Shao authored
      [ Upstream commit fe69230f ]
      
      When linktype is unknown or kzalloc failed in cfctrl_linkup_request(),
      pkt is not released. Add release process to error path.
      
      Fixes: b482cd20 ("net-caif: add CAIF core protocol stack")
      Fixes: 8d545c8f
      
       ("caif: Disconnect without waiting for response")
      Signed-off-by: default avatarZhengchao Shao <shaozhengchao@huawei.com>
      Reviewed-by: default avatarJiri Pirko <jiri@nvidia.com>
      Link: https://lore.kernel.org/r/20230104065146.1153009-1-shaozhengchao@huawei.com
      
      
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      84b2cc7b
    • Dan Carpenter's avatar
      drm/i915: unpin on error in intel_vgpu_shadow_mm_pin() · e5a05837
      Dan Carpenter authored
      [ Upstream commit 3792fc50 ]
      
      Call intel_vgpu_unpin_mm() on this error path.
      
      Fixes: 41874148
      
       ("drm/i915/gvt: Adding ppgtt to GVT GEM context after shadow pdps settled.")
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: default avatarZhenyu Wang <zhenyuw@linux.intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/Y3OQ5tgZIVxyQ/WV@kili
      
      
      Reviewed-by: default avatarZhenyu Wang <zhenyuw@linux.intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      e5a05837
    • Szymon Heidrich's avatar
      usb: rndis_host: Secure rndis_query check against int overflow · 232ef345
      Szymon Heidrich authored
      [ Upstream commit c7dd1380 ]
      
      Variables off and len typed as uint32 in rndis_query function
      are controlled by incoming RNDIS response message thus their
      value may be manipulated. Setting off to a unexpectetly large
      value will cause the sum with len and 8 to overflow and pass
      the implemented validation step. Consequently the response
      pointer will be referring to a location past the expected
      buffer boundaries allowing information leakage e.g. via
      RNDIS_OID_802_3_PERMANENT_ADDRESS OID.
      
      Fixes: ddda0862
      
       ("USB: rndis_host, various cleanups")
      Signed-off-by: default avatarSzymon Heidrich <szymon.heidrich@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      232ef345
    • Daniil Tatianin's avatar
      drivers/net/bonding/bond_3ad: return when there's no aggregator · 2a9ee7c2
      Daniil Tatianin authored
      [ Upstream commit 9c807965 ]
      
      Otherwise we would dereference a NULL aggregator pointer when calling
      __set_agg_ports_ready on the line below.
      
      Found by Linux Verification Center (linuxtesting.org) with the SVACE
      static analysis tool.
      
      Fixes: 1da177e4
      
       ("Linux-2.6.12-rc2")
      Signed-off-by: default avatarDaniil Tatianin <d-tatianin@yandex-team.ru>
      Reviewed-by: default avatarJiri Pirko <jiri@nvidia.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      2a9ee7c2
    • Miaoqian Lin's avatar
      perf tools: Fix resources leak in perf_data__open_dir() · bc6a0993
      Miaoqian Lin authored
      [ Upstream commit 0a6564eb ]
      
      In perf_data__open_dir(), opendir() opens the directory stream.  Add
      missing closedir() to release it after use.
      
      Fixes: eb617670
      
       ("perf data: Add perf_data__open_dir_data function")
      Reviewed-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Signed-off-by: default avatarMiaoqian Lin <linmq006@gmail.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexey Bayduraev <alexey.v.bayduraev@linux.intel.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: https://lore.kernel.org/r/20221229090903.1402395-1-linmq006@gmail.com
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      bc6a0993
    • Jozsef Kadlecsik's avatar
      netfilter: ipset: Rework long task execution when adding/deleting entries · ee756980
      Jozsef Kadlecsik authored
      [ Upstream commit 5e29dc36 ]
      
      When adding/deleting large number of elements in one step in ipset, it can
      take a reasonable amount of time and can result in soft lockup errors. The
      patch 5f7b51bf ("netfilter: ipset: Limit the maximal range of
      consecutive elements to add/delete") tried to fix it by limiting the max
      elements to process at all. However it was not enough, it is still possible
      that we get hung tasks. Lowering the limit is not reasonable, so the
      approach in this patch is as follows: rely on the method used at resizing
      sets and save the state when we reach a smaller internal batch limit,
      unlock/lock and proceed from the saved state. Thus we can avoid long
      continuous tasks and at the same time removed the limit to add/delete large
      number of elements in one step.
      
      The nfnl mutex is held during the whole operation which prevents one to
      issue other ipset commands in parallel.
      
      Fixes: 5f7b51bf
      
       ("netfilter: ipset: Limit the maximal range of consecutive elements to add/delete")
      Reported-by: default avatar <syzbot+9204e7399656300bf271@syzkaller.appspotmail.com>
      Signed-off-by: default avatarJozsef Kadlecsik <kadlec@netfilter.org>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      ee756980
    • Jozsef Kadlecsik's avatar
      netfilter: ipset: fix hash:net,port,net hang with /0 subnet · ba5d2790
      Jozsef Kadlecsik authored
      [ Upstream commit a31d47be ]
      
      The hash:net,port,net set type supports /0 subnets. However, the patch
      commit 5f7b51bf titled "netfilter: ipset: Limit the maximal range
      of consecutive elements to add/delete" did not take into account it and
      resulted in an endless loop. The bug is actually older but the patch
      5f7b51bf brings it out earlier.
      
      Handle /0 subnets properly in hash:net,port,net set types.
      
      Fixes: 5f7b51bf
      
       ("netfilter: ipset: Limit the maximal range of consecutive elements to add/delete")
      Reported-by: default avatarМарк Коренберг <socketpair@gmail.com>
      Signed-off-by: default avatarJozsef Kadlecsik <kadlec@netfilter.org>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      ba5d2790
    • Jamal Hadi Salim's avatar
      net: sched: cbq: dont intepret cls results when asked to drop · b2c917e5
      Jamal Hadi Salim authored
      [ Upstream commit caa4b35b ]
      
      If asked to drop a packet via TC_ACT_SHOT it is unsafe to assume that
      res.class contains a valid pointer
      
      Sample splat reported by Kyle Zeng
      
      [    5.405624] 0: reclassify loop, rule prio 0, protocol 800
      [    5.406326] ==================================================================
      [    5.407240] BUG: KASAN: slab-out-of-bounds in cbq_enqueue+0x54b/0xea0
      [    5.407987] Read of size 1 at addr ffff88800e3122aa by task poc/299
      [    5.408731]
      [    5.408897] CPU: 0 PID: 299 Comm: poc Not tainted 5.10.155+ #15
      [    5.409516] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996),
      BIOS 1.15.0-1 04/01/2014
      [    5.410439] Call Trace:
      [    5.410764]  dump_stack+0x87/0xcd
      [    5.411153]  print_address_description+0x7a/0x6b0
      [    5.411687]  ? vprintk_func+0xb9/0xc0
      [    5.411905]  ? printk+0x76/0x96
      [    5.412110]  ? cbq_enqueue+0x54b/0xea0
      [    5.412323]  kasan_report+0x17d/0x220
      [    5.412591]  ? cbq_enqueue+0x54b/0xea0
      [    5.412803]  __asan_report_load1_noabort+0x10/0x20
      [    5.413119]  cbq_enqueue+0x54b/0xea0
      [    5.413400]  ? __kasan_check_write+0x10/0x20
      [    5.413679]  __dev_queue_xmit+0x9c0/0x1db0
      [    5.413922]  dev_queue_xmit+0xc/0x10
      [    5.414136]  ip_finish_output2+0x8bc/0xcd0
      [    5.414436]  __ip_finish_output+0x472/0x7a0
      [    5.414692]  ip_finish_output+0x5c/0x190
      [    5.414940]  ip_output+0x2d8/0x3c0
      [    5.415150]  ? ip_mc_finish_output+0x320/0x320
      [    5.415429]  __ip_queue_xmit+0x753/0x1760
      [    5.415664]  ip_queue_xmit+0x47/0x60
      [    5.415874]  __tcp_transmit_skb+0x1ef9/0x34c0
      [    5.416129]  tcp_connect+0x1f5e/0x4cb0
      [    5.416347]  tcp_v4_connect+0xc8d/0x18c0
      [    5.416577]  __inet_stream_connect+0x1ae/0xb40
      [    5.416836]  ? local_bh_enable+0x11/0x20
      [    5.417066]  ? lock_sock_nested+0x175/0x1d0
      [    5.417309]  inet_stream_connect+0x5d/0x90
      [    5.417548]  ? __inet_stream_connect+0xb40/0xb40
      [    5.417817]  __sys_connect+0x260/0x2b0
      [    5.418037]  __x64_sys_connect+0x76/0x80
      [    5.418267]  do_syscall_64+0x31/0x50
      [    5.418477]  entry_SYSCALL_64_after_hwframe+0x61/0xc6
      [    5.418770] RIP: 0033:0x473bb7
      [    5.418952] Code: 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00
      00 00 90 f3 0f 1e fa 64 8b 04 25 18 00 00 00 85 c0 75 10 b8 2a 00 00
      00 0f 05 <48> 3d 00 f0 ff ff 77 51 c3 48 83 ec 18 89 54 24 0c 48 89 34
      24 89
      [    5.420046] RSP: 002b:00007fffd20eb0f8 EFLAGS: 00000246 ORIG_RAX:
      000000000000002a
      [    5.420472] RAX: ffffffffffffffda RBX: 00007fffd20eb578 RCX: 0000000000473bb7
      [    5.420872] RDX: 0000000000000010 RSI: 00007fffd20eb110 RDI: 0000000000000007
      [    5.421271] RBP: 00007fffd20eb150 R08: 0000000000000001 R09: 0000000000000004
      [    5.421671] R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000001
      [    5.422071] R13: 00007fffd20eb568 R14: 00000000004fc740 R15: 0000000000000002
      [    5.422471]
      [    5.422562] Allocated by task 299:
      [    5.422782]  __kasan_kmalloc+0x12d/0x160
      [    5.423007]  kasan_kmalloc+0x5/0x10
      [    5.423208]  kmem_cache_alloc_trace+0x201/0x2e0
      [    5.423492]  tcf_proto_create+0x65/0x290
      [    5.423721]  tc_new_tfilter+0x137e/0x1830
      [    5.423957]  rtnetlink_rcv_msg+0x730/0x9f0
      [    5.424197]  netlink_rcv_skb+0x166/0x300
      [    5.424428]  rtnetlink_rcv+0x11/0x20
      [    5.424639]  netlink_unicast+0x673/0x860
      [    5.424870]  netlink_sendmsg+0x6af/0x9f0
      [    5.425100]  __sys_sendto+0x58d/0x5a0
      [    5.425315]  __x64_sys_sendto+0xda/0xf0
      [    5.425539]  do_syscall_64+0x31/0x50
      [    5.425764]  entry_SYSCALL_64_after_hwframe+0x61/0xc6
      [    5.426065]
      [    5.426157] The buggy address belongs to the object at ffff88800e312200
      [    5.426157]  which belongs to the cache kmalloc-128 of size 128
      [    5.426955] The buggy address is located 42 bytes to the right of
      [    5.426955]  128-byte region [ffff88800e312200, ffff88800e312280)
      [    5.427688] The buggy address belongs to the page:
      [    5.427992] page:000000009875fabc refcount:1 mapcount:0
      mapping:0000000000000000 index:0x0 pfn:0xe312
      [    5.428562] flags: 0x100000000000200(slab)
      [    5.428812] raw: 0100000000000200 dead000000000100 dead000000000122
      ffff888007843680
      [    5.429325] raw: 0000000000000000 0000000000100010 00000001ffffffff
      ffff88800e312401
      [    5.429875] page dumped because: kasan: bad access detected
      [    5.430214] page->mem_cgroup:ffff88800e312401
      [    5.430471]
      [    5.430564] Memory state around the buggy address:
      [    5.430846]  ffff88800e312180: fc fc fc fc fc fc fc fc fc fc fc fc
      fc fc fc fc
      [    5.431267]  ffff88800e312200: 00 00 00 00 00 00 00 00 00 00 00 00
      00 00 00 fc
      [    5.431705] >ffff88800e312280: fc fc fc fc fc fc fc fc fc fc fc fc
      fc fc fc fc
      [    5.432123]                                   ^
      [    5.432391]  ffff88800e312300: 00 00 00 00 00 00 00 00 00 00 00 00
      00 00 00 fc
      [    5.432810]  ffff88800e312380: fc fc fc fc fc fc fc fc fc fc fc fc
      fc fc fc fc
      [    5.433229] ==================================================================
      [    5.433648] Disabling lock debugging due to kernel taint
      
      Fixes: 1da177e4
      
       ("Linux-2.6.12-rc2")
      Reported-by: default avatarKyle Zeng <zengyhkyle@gmail.com>
      Signed-off-by: default avatarJamal Hadi Salim <jhs@mojatatu.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      b2c917e5
    • Jamal Hadi Salim's avatar
      net: sched: atm: dont intepret cls results when asked to drop · 5f65f485
      Jamal Hadi Salim authored
      [ Upstream commit a2965c7b ]
      
      If asked to drop a packet via TC_ACT_SHOT it is unsafe to assume
      res.class contains a valid pointer
      Fixes: b0188d4d
      
       ("[NET_SCHED]: sch_atm: Lindent")
      
      Signed-off-by: default avatarJamal Hadi Salim <jhs@mojatatu.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      5f65f485
    • Miaoqian Lin's avatar
      gpio: sifive: Fix refcount leak in sifive_gpio_probe · f4a2ad10
      Miaoqian Lin authored
      [ Upstream commit 694175cd ]
      
      of_irq_find_parent() returns a node pointer with refcount incremented,
      We should use of_node_put() on it when not needed anymore.
      Add missing of_node_put() to avoid refcount leak.
      
      Fixes: 96868dce
      
       ("gpio/sifive: Add GPIO driver for SiFive SoCs")
      Signed-off-by: default avatarMiaoqian Lin <linmq006@gmail.com>
      Signed-off-by: default avatarBartosz Golaszewski <bartosz.golaszewski@linaro.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      f4a2ad10
    • Xiubo Li's avatar
      ceph: switch to vfs_inode_has_locks() to fix file lock bug · 7ec369e2
      Xiubo Li authored
      [ Upstream commit 461ab10e ]
      
      For the POSIX locks they are using the same owner, which is the
      thread id. And multiple POSIX locks could be merged into single one,
      so when checking whether the 'file' has locks may fail.
      
      For a file where some openers use locking and others don't is a
      really odd usage pattern though. Locks are like stoplights -- they
      only work if everyone pays attention to them.
      
      Just switch ceph_get_caps() to check whether any locks are set on
      the inode. If there are POSIX/OFD/FLOCK locks on the file at the
      time, we should set CHECK_FILELOCK, regardless of what fd was used
      to set the lock.
      
      Fixes: ff5d913d
      
       ("ceph: return -EIO if read/write against filp that lost file locks")
      Signed-off-by: default avatarXiubo Li <xiubli@redhat.com>
      Reviewed-by: default avatarJeff Layton <jlayton@kernel.org>
      Reviewed-by: default avatarIlya Dryomov <idryomov@gmail.com>
      Signed-off-by: default avatarIlya Dryomov <idryomov@gmail.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      7ec369e2
    • Jeff Layton's avatar
      filelock: new helper: vfs_inode_has_locks · 40771042
      Jeff Layton authored
      [ Upstream commit ab1ddef9
      
       ]
      
      Ceph has a need to know whether a particular inode has any locks set on
      it. It's currently tracking that by a num_locks field in its
      filp->private_data, but that's problematic as it tries to decrement this
      field when releasing locks and that can race with the file being torn
      down.
      
      Add a new vfs_inode_has_locks helper that just returns whether any locks
      are currently held on the inode.
      
      Reviewed-by: default avatarXiubo Li <xiubli@redhat.com>
      Reviewed-by: default avatarChristoph Hellwig <hch@infradead.org>
      Signed-off-by: default avatarJeff Layton <jlayton@kernel.org>
      Stable-dep-of: 461ab10e
      
       ("ceph: switch to vfs_inode_has_locks() to fix file lock bug")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      40771042
    • Carlo Caione's avatar
      drm/meson: Reduce the FIFO lines held when AFBC is not used · 9f0ff5de
      Carlo Caione authored
      [ Upstream commit 3b754ed6 ]
      
      Having a bigger number of FIFO lines held after vsync is only useful to
      SoCs using AFBC to give time to the AFBC decoder to be reset, configured
      and enabled again.
      
      For SoCs not using AFBC this, on the contrary, is causing on some
      displays issues and a few pixels vertical offset in the displayed image.
      
      Conditionally increase the number of lines held after vsync only for
      SoCs using AFBC, leaving the default value for all the others.
      
      Fixes: 24e0d405
      
       ("drm/meson: hold 32 lines after vsync to give time for AFBC start")
      Signed-off-by: default avatarCarlo Caione <ccaione@baylibre.com>
      Acked-by: default avatarMartin Blumenstingl <martin.blumenstingl@googlemail.com>
      Acked-by: default avatarNeil Armstrong <neil.armstrong@linaro.org>
      [narmstrong: added fixes tag]
      Signed-off-by: default avatarNeil Armstrong <neil.armstrong@linaro.org>
      Link: https://patchwork.freedesktop.org/patch/msgid/20221216-afbc_s905x-v1-0-033bebf780d9@baylibre.com
      
      
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      9f0ff5de
    • Maor Gottlieb's avatar
      RDMA/mlx5: Fix validation of max_rd_atomic caps for DC · ae2639cd
      Maor Gottlieb authored
      [ Upstream commit 8de8482f ]
      
      Currently, when modifying DC, we validate max_rd_atomic user attribute
      against the RC cap, validate against DC. RC and DC QP types have different
      device limitations.
      
      This can cause userspace created DC QPs to malfunction.
      
      Fixes: c32a4f29 ("IB/mlx5: Add support for DC Initiator QP")
      Link: https://lore.kernel.org/r/0c5aee72cea188c3bb770f4207cce7abc9b6fc74.1672231736.git.leonro@nvidia.com
      
      
      Signed-off-by: default avatarMaor Gottlieb <maorg@nvidia.com>
      Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      ae2639cd
    • Miaoqian Lin's avatar
      net: phy: xgmiitorgmii: Fix refcount leak in xgmiitorgmii_probe · 106d0d33
      Miaoqian Lin authored
      [ Upstream commit d0395358 ]
      
      of_phy_find_device() return device node with refcount incremented.
      Call put_device() to relese it when not needed anymore.
      
      Fixes: ab4e6ee5
      
       ("net: phy: xgmiitorgmii: Check phy_driver ready before accessing")
      Signed-off-by: default avatarMiaoqian Lin <linmq006@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      106d0d33
    • Jiguang Xiao's avatar
      net: amd-xgbe: add missed tasklet_kill · 398e14bb
      Jiguang Xiao authored
      [ Upstream commit d530ece7 ]
      
      The driver does not call tasklet_kill in several places.
      Add the calls to fix it.
      
      Fixes: 85b85c85
      
       ("amd-xgbe: Re-issue interrupt if interrupt status not cleared")
      Signed-off-by: default avatarJiguang Xiao <jiguang.xiao@windriver.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      398e14bb
    • Adham Faris's avatar
      net/mlx5e: Fix hw mtu initializing at XDP SQ allocation · e3d90ca9
      Adham Faris authored
      [ Upstream commit 1e267ab8 ]
      
      Current xdp xmit functions logic (mlx5e_xmit_xdp_frame_mpwqe or
      mlx5e_xmit_xdp_frame), validates xdp packet length by comparing it to
      hw mtu (configured at xdp sq allocation) before xmiting it. This check
      does not account for ethernet fcs length (calculated and filled by the
      nic). Hence, when we try sending packets with length > (hw-mtu -
      ethernet-fcs-size), the device port drops it and tx_errors_phy is
      incremented. Desired behavior is to catch these packets and drop them
      by the driver.
      
      Fix this behavior in XDP SQ allocation function (mlx5e_alloc_xdpsq) by
      subtracting ethernet FCS header size (4 Bytes) from current hw mtu
      value, since ethernet FCS is calculated and written to ethernet frames
      by the nic.
      
      Fixes: d8bec2b2
      
       ("net/mlx5e: Support bpf_xdp_adjust_head()")
      Signed-off-by: default avatarAdham Faris <afaris@nvidia.com>
      Reviewed-by: default avatarTariq Toukan <tariqt@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      e3d90ca9
    • Dragos Tatulea's avatar
      net/mlx5e: IPoIB, Don't allow CQE compression to be turned on by default · 6d655a9d
      Dragos Tatulea authored
      [ Upstream commit b12d581e ]
      
      mlx5e_build_nic_params will turn CQE compression on if the hardware
      capability is enabled and the slow_pci_heuristic condition is detected.
      As IPoIB doesn't support CQE compression, make sure to disable the
      feature in the IPoIB profile init.
      
      Please note that the feature is not exposed to the user for IPoIB
      interfaces, so it can't be subsequently turned on.
      
      Fixes: b797a684
      
       ("net/mlx5e: Enable CQE compression when PCI is slower than link")
      Signed-off-by: default avatarDragos Tatulea <dtatulea@nvidia.com>
      Reviewed-by: default avatarGal Pressman <gal@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      6d655a9d
    • Shay Drory's avatar
      net/mlx5: Avoid recovery in probe flows · 670b2061
      Shay Drory authored
      [ Upstream commit 9078e843 ]
      
      Currently, recovery is done without considering whether the device is
      still in probe flow.
      This may lead to recovery before device have finished probed
      successfully. e.g.: while mlx5_init_one() is running. Recovery flow is
      using functionality that is loaded only by mlx5_init_one(), and there
      is no point in running recovery without mlx5_init_one() finished
      successfully.
      
      Fix it by waiting for probe flow to finish and checking whether the
      device is probed before trying to perform recovery.
      
      Fixes: 51d138c2
      
       ("net/mlx5: Fix health error state handling")
      Signed-off-by: default avatarShay Drory <shayd@nvidia.com>
      Reviewed-by: default avatarMoshe Shemesh <moshe@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      670b2061
    • Jiri Pirko's avatar
      net/mlx5: Add forgotten cleanup calls into mlx5_init_once() error path · 66b92b80
      Jiri Pirko authored
      [ Upstream commit 2a35b2c2 ]
      
      There are two cleanup calls missing in mlx5_init_once() error path.
      Add them making the error path flow to be the same as
      mlx5_cleanup_once().
      
      Fixes: 52ec462e ("net/mlx5: Add reserved-gids support")
      Fixes: 7c39afb3
      
       ("net/mlx5: PTP code migration to driver core section")
      Signed-off-by: default avatarJiri Pirko <jiri@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      66b92b80
    • Stefano Garzarella's avatar
      vhost: fix range used in translate_desc() · b6c74d23
      Stefano Garzarella authored
      [ Upstream commit 98047313 ]
      
      vhost_iotlb_itree_first() requires `start` and `last` parameters
      to search for a mapping that overlaps the range.
      
      In translate_desc() we cyclically call vhost_iotlb_itree_first(),
      incrementing `addr` by the amount already translated, so rightly
      we move the `start` parameter passed to vhost_iotlb_itree_first(),
      but we should hold the `last` parameter constant.
      
      Let's fix it by saving the `last` parameter value before incrementing
      `addr` in the loop.
      
      Fixes: a9709d68
      
       ("vhost: convert pre sorted vhost memory array to interval tree")
      Acked-by: default avatarJason Wang <jasowang@redhat.com>
      Signed-off-by: default avatarStefano Garzarella <sgarzare@redhat.com>
      Message-Id: <20221109102503.18816-3-sgarzare@redhat.com>
      Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      b6c74d23
    • Stefano Garzarella's avatar
      vringh: fix range used in iotlb_translate() · 264fb6dc
      Stefano Garzarella authored
      [ Upstream commit f85efa9b ]
      
      vhost_iotlb_itree_first() requires `start` and `last` parameters
      to search for a mapping that overlaps the range.
      
      In iotlb_translate() we cyclically call vhost_iotlb_itree_first(),
      incrementing `addr` by the amount already translated, so rightly
      we move the `start` parameter passed to vhost_iotlb_itree_first(),
      but we should hold the `last` parameter constant.
      
      Let's fix it by saving the `last` parameter value before incrementing
      `addr` in the loop.
      
      Fixes: 9ad9c49c
      
       ("vringh: IOTLB support")
      Acked-by: default avatarJason Wang <jasowang@redhat.com>
      Signed-off-by: default avatarStefano Garzarella <sgarzare@redhat.com>
      Message-Id: <20221109102503.18816-2-sgarzare@redhat.com>
      Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      264fb6dc