Skip to content
  1. Jan 14, 2023
  2. Jan 12, 2023
    • Greg Kroah-Hartman's avatar
      d5728772
    • Jocelyn Falempe's avatar
      drm/mgag200: Fix PLL setup for G200_SE_A rev >=4 · 24186c68
      Jocelyn Falempe authored
      commit b389286d upstream.
      
      For G200_SE_A, PLL M setting is wrong, which leads to blank screen,
      or "signal out of range" on VGA display.
      previous code had "m |= 0x80" which was changed to
      m |= ((pixpllcn & BIT(8)) >> 1);
      
      Tested on G200_SE_A rev 42
      
      This line of code was moved to another file with
      commit 877507bb ("drm/mgag200: Provide per-device callbacks for
      PIXPLLC") but can be easily backported before this commit.
      
      v2: * put BIT(7) First to respect MSB-to-LSB (Thomas)
          * Add a comment to explain that this bit must be set (Thomas)
      
      Fixes: 2dd04094
      
       ("drm/mgag200: Store values (not bits) in struct mgag200_pll_values")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJocelyn Falempe <jfalempe@redhat.com>
      Reviewed-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
      Link: https://patchwork.freedesktop.org/patch/msgid/20221013132810.521945-1-jfalempe@redhat.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      24186c68
    • Harshit Mogalapalli's avatar
      io_uring: Fix unsigned 'res' comparison with zero in io_fixup_rw_res() · e326ee01
      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>
      e326ee01
    • Ard Biesheuvel's avatar
      efi: random: combine bootloader provided RNG seed with RNG protocol output · b2b6eefa
      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>
      b2b6eefa
    • Jan Kara's avatar
      mbcache: Avoid nesting of cache->c_list_lock under bit locks · 99c07594
      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>
      99c07594
    • Jie Wang's avatar
      net: hns3: fix return value check bug of rx copybreak · d50d6c19
      Jie Wang authored
      commit 29df7c69 upstream.
      
      The refactoring of rx copybreak modifies the original return logic, which
      will make this feature unavailable. So this patch fixes the return logic of
      rx copybreak.
      
      Fixes: e74a726d ("net: hns3: refactor hns3_nic_reuse_page()")
      Fixes: 99f6b5fb
      
       ("net: hns3: use bounce buffer when rx page can not be reused")
      Signed-off-by: default avatarJie Wang <wangjie125@huawei.com>
      Signed-off-by: default avatarHao Lan <lanhao@huawei.com>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d50d6c19
    • Qu Wenruo's avatar
      btrfs: make thaw time super block check to also verify checksum · d4e6a13e
      Qu Wenruo authored
      commit 3d17adea upstream.
      
      Previous commit a05d3c91 ("btrfs: check superblock to ensure the fs
      was not modified at thaw time") only checks the content of the super
      block, but it doesn't really check if the on-disk super block has a
      matching checksum.
      
      This patch will add the checksum verification to thaw time superblock
      verification.
      
      This involves the following extra changes:
      
      - Export btrfs_check_super_csum()
        As we need to call it in super.c.
      
      - Change the argument list of btrfs_check_super_csum()
        Instead of passing a char *, directly pass struct btrfs_super_block *
        pointer.
      
      - Verify that our checksum type didn't change before checking the
        checksum value, like it's done at mount time
      
      Fixes: a05d3c91
      
       ("btrfs: check superblock to ensure the fs was not modified at thaw time")
      Reviewed-by: default avatarJohannes Thumshirn <johannes.thumshirn@wdc.com>
      Signed-off-by: default avatarQu Wenruo <wqu@suse.com>
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d4e6a13e
    • Muhammad Usama Anjum's avatar
      selftests: set the BUILD variable to absolute path · 70a1dccd
      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>
      70a1dccd
    • Eric Biggers's avatar
      ext4: don't allow journal inode to have encrypt flag · 58fef3eb
      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>
      58fef3eb
    • Matthieu Baerts's avatar
      mptcp: use proper req destructor for IPv6 · bd5dc96f
      Matthieu Baerts authored
      commit d3295fee upstream.
      
      Before, only the destructor from TCP request sock in IPv4 was called
      even if the subflow was IPv6.
      
      It is important to use the right destructor to avoid memory leaks with
      some advanced IPv6 features, e.g. when the request socks contain
      specific IPv6 options.
      
      Fixes: 79c0949e
      
       ("mptcp: Add key generation and token tree")
      Reviewed-by: default avatarMat Martineau <mathew.j.martineau@linux.intel.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarMatthieu Baerts <matthieu.baerts@tessares.net>
      Signed-off-by: default avatarMat Martineau <mathew.j.martineau@linux.intel.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      bd5dc96f
    • Matthieu Baerts's avatar
      mptcp: dedicated request sock for subflow in v6 · 78bd6ab5
      Matthieu Baerts authored
      commit 34b21d1d upstream.
      
      tcp_request_sock_ops structure is specific to IPv4. It should then not
      be used with MPTCP subflows on top of IPv6.
      
      For example, it contains the 'family' field, initialised to AF_INET.
      This 'family' field is used by TCP FastOpen code to generate the cookie
      but also by TCP Metrics, SELinux and SYN Cookies. Using the wrong family
      will not lead to crashes but displaying/using/checking wrong things.
      
      Note that 'send_reset' callback from request_sock_ops structure is used
      in some error paths. It is then also important to use the correct one
      for IPv4 or IPv6.
      
      The slab name can also be different in IPv4 and IPv6, it will be used
      when printing some log messages. The slab pointer will anyway be the
      same because the object size is the same for both v4 and v6. A
      BUILD_BUG_ON() has also been added to make sure this size is the same.
      
      Fixes: cec37a6e
      
       ("mptcp: Handle MP_CAPABLE options for outgoing connections")
      Reviewed-by: default avatarMat Martineau <mathew.j.martineau@linux.intel.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarMatthieu Baerts <matthieu.baerts@tessares.net>
      Signed-off-by: default avatarMat Martineau <mathew.j.martineau@linux.intel.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      78bd6ab5
    • Mario Limonciello's avatar
      Revert "ACPI: PM: Add support for upcoming AMD uPEP HID AMDI007" · 6e9c1aef
      Mario Limonciello authored
      A number of AMD based Rembrandt laptops are not working properly in
      suspend/resume.  This has been root caused to be from the BIOS
      implementation not populating code for the AMD GUID in uPEP, but
      instead only the Microsoft one.
      
      In later kernels this has been fixed by using the Microsoft GUID
      instead.
      
      The following series of patches has fixed it in newer kernels:
      
      commit ed470feb ("ACPI: PM: s2idle: Add support for upcoming AMD uPEP HID AMDI008")
      commit 1a2dcab5 ("ACPI: PM: s2idle: Use LPS0 idle if ACPI_FADT_LOW_POWER_S0 is unset")
      commit 100a5737 ("ACPI: x86: s2idle: Move _HID handling for AMD systems into structures")
      commit fd894f05 ("ACPI: x86: s2idle: If a new AMD _HID is missing assume Rembrandt")
      commit a0bc0023 ("ACPI: x86: s2idle: Add module parameter to prefer Microsoft GUID")
      commit d0f61e89 ("ACPI: x86: s2idle: Add a quirk for ASUS TUF Gaming A17 FA707RE")
      commit ddeea2c3 ("ACPI: x86: s2idle: Add a quirk for ASUS ROG Zephyrus G14")
      commit 888ca9c7 ("ACPI: x86: s2idle: Add a quirk for Lenovo Slim 7 Pro 14ARH7")
      commit 631b5451 ("ACPI: x86: s2idle: Add a quirk for ASUSTeK COMPUTER INC. ROG Flow X13")
      commit 39f81776 ("ACPI: x86: s2idle: Fix a NULL pointer dereference")
      commit 54bd1e54 ("ACPI: x86: s2idle: Add another ID to s2idle_dmi_table")
      commit 577821f7 ("ACPI: x86: s2idle: Force AMD GUID/_REV 2 on HP Elitebook 865")
      commit e6d180a3 ("ACPI: x86: s2idle: Stop using AMD specific codepath for Rembrandt+")
      
      This is needlessly complex for 5.15.y though.  To accomplish the same
      effective result revert commit f0c62255
      
       ("ACPI: PM: Add support for
      upcoming AMD uPEP HID AMDI007") instead.
      
      Link: https://lore.kernel.org/stable/MN0PR12MB61015DB3D6EDBFD841157918E2F59@MN0PR12MB6101.namprd12.prod.outlook.com/
      Signed-off-by: default avatarMario Limonciello <mario.limonciello@amd.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6e9c1aef
    • William Liu's avatar
      ksmbd: check nt_len to be at least CIFS_ENCPWD_SIZE in ksmbd_decode_ntlmssp_auth_blob · e32f867b
      William Liu authored
      commit 797805d8 upstream.
      
      "nt_len - CIFS_ENCPWD_SIZE" is passed directly from
      ksmbd_decode_ntlmssp_auth_blob to ksmbd_auth_ntlmv2. Malicious requests
      can set nt_len to less than CIFS_ENCPWD_SIZE, which results in a negative
      number (or large unsigned value) used for a subsequent memcpy in
      ksmbd_auth_ntlvm2 and can cause a panic.
      
      Fixes: e2f34481
      
       ("cifsd: add server-side procedures for SMB3")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarWilliam Liu <will@willsroot.io>
      Signed-off-by: default avatarHrvoje Mišetić <misetichrvoje@gmail.com>
      Acked-by: default avatarNamjae Jeon <linkinjeon@kernel.org>
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e32f867b
    • Namjae Jeon's avatar
      ksmbd: fix infinite loop in ksmbd_conn_handler_loop() · 4136f1ac
      Namjae Jeon authored
      commit 83dcedd5 upstream.
      
      If kernel_recvmsg() return -EAGAIN in ksmbd_tcp_readv() and go round
      again, It will cause infinite loop issue. And all threads from next
      connections would be doing that. This patch add max retry count(2) to
      avoid it. kernel_recvmsg() will wait during 7sec timeout and try to
      retry two time if -EAGAIN is returned. And add flags of kvmalloc to
      __GFP_NOWARN and __GFP_NORETRY to disconnect immediately without
      retrying on memory alloation failure.
      
      Fixes: 0626e664
      
       ("cifsd: add server handler for central processing and tranport layers")
      Cc: stable@vger.kernel.org
      Reported-by: zdi-disclosures@trendmicro.com # ZDI-CAN-18259
      Reviewed-by: default avatarSergey Senozhatsky <senozhatsky@chromium.org>
      Signed-off-by: default avatarNamjae Jeon <linkinjeon@kernel.org>
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4136f1ac
    • Linus Torvalds's avatar
      hfs/hfsplus: avoid WARN_ON() for sanity check, use proper error handling · f10defb0
      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>
      f10defb0
    • Arnd Bergmann's avatar
      hfs/hfsplus: use WARN_ON for sanity check · 48d9e2e6
      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>
      48d9e2e6
    • Zhenyu Wang's avatar
      drm/i915/gvt: fix vgpu debugfs clean in remove · f5a9bbf9
      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>
      f5a9bbf9
    • Zhenyu Wang's avatar
      drm/i915/gvt: fix gvt debugfs destroy · ae9a6151
      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>
      ae9a6151
    • Björn Töpel's avatar
      riscv, kprobes: Stricter c.jr/c.jalr decoding · eb3e943a
      Björn Töpel authored
      commit b2d473a6 upstream.
      
      In the compressed instruction extension, c.jr, c.jalr, c.mv, and c.add
      is encoded the following way (each instruction is 16b):
      
      ---+-+-----------+-----------+--
      100 0 rs1[4:0]!=0       00000 10 : c.jr
      100 1 rs1[4:0]!=0       00000 10 : c.jalr
      100 0  rd[4:0]!=0 rs2[4:0]!=0 10 : c.mv
      100 1  rd[4:0]!=0 rs2[4:0]!=0 10 : c.add
      
      The following logic is used to decode c.jr and c.jalr:
      
        insn & 0xf007 == 0x8002 => instruction is an c.jr
        insn & 0xf007 == 0x9002 => instruction is an c.jalr
      
      When 0xf007 is used to mask the instruction, c.mv can be incorrectly
      decoded as c.jr, and c.add as c.jalr.
      
      Correct the decoding by changing the mask from 0xf007 to 0xf07f.
      
      Fixes: c22b0bcb
      
       ("riscv: Add kprobes supported")
      Signed-off-by: default avatarBjörn Töpel <bjorn@rivosinc.com>
      Reviewed-by: default avatarConor Dooley <conor.dooley@microchip.com>
      Reviewed-by: default avatarGuo Ren <guoren@kernel.org>
      Link: https://lore.kernel.org/r/20230102160748.1307289-1-bjorn@kernel.org
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      eb3e943a
    • Ben Dooks's avatar
      riscv: uaccess: fix type of 0 variable on error in get_user() · 620a229f
      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>
      620a229f
    • Srinivas Pandruvada's avatar
      thermal: int340x: Add missing attribute for data rate base · 8e05a993
      Srinivas Pandruvada authored
      commit b878d3ba upstream.
      
      Commit 473be511 ("thermal: int340x: processor_thermal: Add RFIM
      driver")' added rfi_restriction_data_rate_base string, mmio details and
      documentation, but missed adding attribute to sysfs.
      
      Add missing sysfs attribute.
      
      Fixes: 473be511
      
       ("thermal: int340x: processor_thermal: Add RFIM driver")
      Cc: 5.11+ <stable@vger.kernel.org> # v5.11+
      Signed-off-by: default avatarSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8e05a993
    • Pavel Begunkov's avatar
      io_uring: fix CQ waiting timeout handling · c3222fd2
      Pavel Begunkov authored
      commit 12521a5d upstream.
      
      Jiffy to ktime CQ waiting conversion broke how we treat timeouts, in
      particular we rearm it anew every time we get into
      io_cqring_wait_schedule() without adjusting the timeout. Waiting for 2
      CQEs and getting a task_work in the middle may double the timeout value,
      or even worse in some cases task may wait indefinitely.
      
      Cc: stable@vger.kernel.org
      Fixes: 22833966
      
       ("io_uring: don't convert to jiffies for waiting on timeouts")
      Signed-off-by: default avatarPavel Begunkov <asml.silence@gmail.com>
      Link: https://lore.kernel.org/r/f7bffddd71b08f28a877d44d37ac953ddb01590d.1672915663.git.asml.silence@gmail.com
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c3222fd2
    • Jens Axboe's avatar
      block: don't allow splitting of a REQ_NOWAIT bio · b7b9bc93
      Jens Axboe authored
      commit 9cea62b2
      
       upstream.
      
      If we split a bio marked with REQ_NOWAIT, then we can trigger spurious
      EAGAIN if constituent parts of that split bio end up failing request
      allocations. Parts will complete just fine, but just a single failure
      in one of the chained bios will yield an EAGAIN final result for the
      parent bio.
      
      Return EAGAIN early if we end up needing to split such a bio, which
      allows for saner recovery handling.
      
      Cc: stable@vger.kernel.org # 5.15+
      Link: https://github.com/axboe/liburing/issues/766
      Reported-by: default avatarMichael Kelley <mikelley@microsoft.com>
      Reviewed-by: default avatarKeith Busch <kbusch@kernel.org>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b7b9bc93
    • Paul Menzel's avatar
      fbdev: matroxfb: G200eW: Increase max memory from 1 MB to 16 MB · e1358c87
      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>
      e1358c87
    • Jeff Layton's avatar
      nfsd: fix handling of readdir in v4root vs. mount upcall timeout · 682a7d06
      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>
      682a7d06
    • Rodrigo Branco's avatar
      x86/bugs: Flush IBP in ib_prctl_set() · cb42aa7b
      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>
      cb42aa7b