Skip to content
  1. Jan 01, 2024
    • Mauricio Faria de Oliveira's avatar
      loop: do not enforce max_loop hard limit by (new) default · e9779fac
      Mauricio Faria de Oliveira authored
      [ Upstream commit bb5faa99 ]
      
      Problem:
      
      The max_loop parameter is used for 2 different purposes:
      
      1) initial number of loop devices to pre-create on init
      2) maximum number of loop devices to add on access/open()
      
      Historically, its default value (zero) caused 1) to create non-zero
      number of devices (CONFIG_BLK_DEV_LOOP_MIN_COUNT), and no hard limit on
      2) to add devices with autoloading.
      
      However, the default value changed in commit 85c50197 ("loop: Fix
      the max_loop commandline argument treatment when it is set to 0") to
      CONFIG_BLK_DEV_LOOP_MIN_COUNT, for max_loop=0 not to pre-create devices.
      
      That does improve 1), but unfortunately it breaks 2), as the default
      behavior changed from no-limit to hard-limit.
      
      Example:
      
      For example, this userspace code broke for N >= CONFIG, if the user
      relied on the default value 0 for max_loop:
      
          mknod("/dev/loopN");
          open("/dev/loopN");  // now fails with ENXIO
      
      Though affected users may "fix" it with (loop.)max_loop=0, this means to
      require a kernel parameter change on stable kernel update (that commit
      Fixes: an old commit in stable).
      
      Solution:
      
      The original semantics for the default value in 2) can be applied if the
      parameter is not set (ie, default behavior).
      
      This still keeps the intended function in 1) and 2) if set, and that
      commit's intended improvement in 1) if max_loop=0.
      
      Before 85c50197:
        - default:     1) CONFIG devices   2) no limit
        - max_loop=0:  1) CONFIG devices   2) no limit
        - max_loop=X:  1) X devices        2) X limit
      
      After 85c50197:
        - default:     1) CONFIG devices   2) CONFIG limit (*)
        - max_loop=0:  1) 0 devices (*)    2) no limit
        - max_loop=X:  1) X devices        2) X limit
      
      This commit:
        - default:     1) CONFIG devices   2) no limit (*)
        - max_loop=0:  1) 0 devices        2) no limit
        - max_loop=X:  1) X devices        2) X limit
      
      Future:
      
      The issue/regression from that commit only affects code under the
      CONFIG_BLOCK_LEGACY_AUTOLOAD deprecation guard, thus the fix too is
      contained under it.
      
      Once that deprecated functionality/code is removed, the purpose 2) of
      max_loop (hard limit) is no longer in use, so the module parameter
      description can be changed then.
      
      Tests:
      
      Linux 6.4-rc7
      CONFIG_BLK_DEV_LOOP_MIN_COUNT=8
      CONFIG_BLOCK_LEGACY_AUTOLOAD=y
      
      - default (original)
      
      	# ls -1 /dev/loop*
      	/dev/loop-control
      	/dev/loop0
      	...
      	/dev/loop7
      
      	# ./test-loop
      	open: /dev/loop8: No such device or address
      
      - default (patched)
      
      	# ls -1 /dev/loop*
      	/dev/loop-control
      	/dev/loop0
      	...
      	/dev/loop7
      
      	# ./test-loop
      	#
      
      - max_loop=0 (original & patched):
      
      	# ls -1 /dev/loop*
      	/dev/loop-control
      
      	# ./test-loop
      	#
      
      - max_loop=8 (original & patched):
      
      	# ls -1 /dev/loop*
      	/dev/loop-control
      	/dev/loop0
      	...
      	/dev/loop7
      
      	# ./test-loop
      	open: /dev/loop8: No such device or address
      
      - max_loop=0 (patched; CONFIG_BLOCK_LEGACY_AUTOLOAD is not set)
      
      	# ls -1 /dev/loop*
      	/dev/loop-control
      
      	# ./test-loop
      	open: /dev/loop8: No such device or address
      
      Fixes: 85c50197
      
       ("loop: Fix the max_loop commandline argument treatment when it is set to 0")
      Signed-off-by: default avatarMauricio Faria de Oliveira <mfo@canonical.com>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Link: https://lore.kernel.org/r/20230720143033.841001-3-mfo@canonical.com
      
      
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      e9779fac
    • Heiko Stuebner's avatar
      RISC-V: Fix do_notify_resume / do_work_pending prototype · 600043e1
      Heiko Stuebner authored
      [ Upstream commit 285b6a18 ]
      
      Commit b0f4c74e ("RISC-V: Fix unannoted hardirqs-on in return to
      userspace slow-path") renamed the do_notify_resume function to
      do_work_pending but did not change the prototype in signal.h
      Do that now, as the original function does not exist anymore.
      
      Fixes: b0f4c74e
      
       ("RISC-V: Fix unannoted hardirqs-on in return to userspace slow-path")
      Signed-off-by: default avatarHeiko Stuebner <heiko.stuebner@vrull.eu>
      Reviewed-by: default avatarAndrew Jones <ajones@ventanamicro.com>
      Reviewed-by: default avatarConor Dooley <conor.dooley@microchip.com>
      Link: https://lore.kernel.org/r/20230118142252.337103-1-heiko@sntech.de
      
      
      Signed-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      600043e1
    • JP Kobryn's avatar
      9p: prevent read overrun in protocol dump tracepoint · 764c6790
      JP Kobryn authored
      commit a931c681
      
       upstream.
      
      An out of bounds read can occur within the tracepoint 9p_protocol_dump. In
      the fast assign, there is a memcpy that uses a constant size of 32 (macro
      named P9_PROTO_DUMP_SZ). When the copy is invoked, the source buffer is not
      guaranteed match this size.  It was found that in some cases the source
      buffer size is less than 32, resulting in a read that overruns.
      
      The size of the source buffer seems to be known at the time of the
      tracepoint being invoked. The allocations happen within p9_fcall_init(),
      where the capacity field is set to the allocated size of the payload
      buffer. This patch tries to fix the overrun by changing the fixed array to
      a dynamically sized array and using the minimum of the capacity value or
      P9_PROTO_DUMP_SZ as its length. The trace log statement is adjusted to
      account for this. Note that the trace log no longer splits the payload on
      the first 16 bytes. The full payload is now logged to a single line.
      
      To repro the orignal problem, operations to a plan 9 managed resource can
      be used. The simplest approach might just be mounting a shared filesystem
      (between host and guest vm) using the plan 9 protocol while the tracepoint
      is enabled.
      
      mount -t 9p -o trans=virtio <mount_tag> <mount_path>
      
      The bpftrace program below can be used to show the out of bounds read.
      Note that a recent version of bpftrace is needed for the raw tracepoint
      support. The script was tested using v0.19.0.
      
      /* from include/net/9p/9p.h */
      struct p9_fcall {
          u32 size;
          u8 id;
          u16 tag;
          size_t offset;
          size_t capacity;
          struct kmem_cache *cache;
          u8 *sdata;
          bool zc;
      };
      
      tracepoint:9p:9p_protocol_dump
      {
          /* out of bounds read can happen when this tracepoint is enabled */
      }
      
      rawtracepoint:9p_protocol_dump
      {
          $pdu = (struct p9_fcall *)arg1;
          $dump_sz = (uint64)32;
      
          if ($dump_sz > $pdu->capacity) {
              printf("reading %zu bytes from src buffer of %zu bytes\n",
                  $dump_sz, $pdu->capacity);
          }
      }
      
      Signed-off-by: default avatarJP Kobryn <inwardvessel@gmail.com>
      Message-ID: <20231204202321.22730-1-inwardvessel@gmail.com>
      Fixes: 60ece083
      
       ("net/9p: allocate appropriate reduced message buffers")
      Cc: stable@vger.kernel.org
      Reviewed-by: default avatarChristian Schoenebeck <linux_oss@crudebyte.com>
      Signed-off-by: default avatarDominique Martinet <asmadeus@codewreck.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      764c6790
    • Ville Syrjälä's avatar
      drm/i915: Reject async flips with bigjoiner · 7d09c84d
      Ville Syrjälä authored
      commit 88a173e5 upstream.
      
      Currently async flips are busted when bigjoiner is in use.
      As a short term fix simply reject async flips in that case.
      
      Cc: stable@vger.kernel.org
      Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/9769
      
      
      Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20231211081134.2698-1-ville.syrjala@linux.intel.com
      
      
      Reviewed-by: default avatarStanislav Lisovskiy <stanislav.lisovskiy@intel.com>
      (cherry picked from commit e93bffc2
      
      )
      Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7d09c84d
    • Paulo Alcantara's avatar
      smb: client: fix OOB in smbCalcSize() · c60e10d1
      Paulo Alcantara authored
      commit b35858b3
      
       upstream.
      
      Validate @smb->WordCount to avoid reading off the end of @smb and thus
      causing the following KASAN splat:
      
        BUG: KASAN: slab-out-of-bounds in smbCalcSize+0x32/0x40 [cifs]
        Read of size 2 at addr ffff88801c024ec5 by task cifsd/1328
      
        CPU: 1 PID: 1328 Comm: cifsd Not tainted 6.7.0-rc5 #9
        Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS
        rel-1.16.2-3-gd478f380-rebuilt.opensuse.org 04/01/2014
        Call Trace:
         <TASK>
         dump_stack_lvl+0x4a/0x80
         print_report+0xcf/0x650
         ? srso_alias_return_thunk+0x5/0xfbef5
         ? srso_alias_return_thunk+0x5/0xfbef5
         ? __phys_addr+0x46/0x90
         kasan_report+0xd8/0x110
         ? smbCalcSize+0x32/0x40 [cifs]
         ? smbCalcSize+0x32/0x40 [cifs]
         kasan_check_range+0x105/0x1b0
         smbCalcSize+0x32/0x40 [cifs]
         checkSMB+0x162/0x370 [cifs]
         ? __pfx_checkSMB+0x10/0x10 [cifs]
         cifs_handle_standard+0xbc/0x2f0 [cifs]
         ? srso_alias_return_thunk+0x5/0xfbef5
         cifs_demultiplex_thread+0xed1/0x1360 [cifs]
         ? __pfx_cifs_demultiplex_thread+0x10/0x10 [cifs]
         ? srso_alias_return_thunk+0x5/0xfbef5
         ? lockdep_hardirqs_on_prepare+0x136/0x210
         ? __pfx_lock_release+0x10/0x10
         ? srso_alias_return_thunk+0x5/0xfbef5
         ? mark_held_locks+0x1a/0x90
         ? lockdep_hardirqs_on_prepare+0x136/0x210
         ? srso_alias_return_thunk+0x5/0xfbef5
         ? srso_alias_return_thunk+0x5/0xfbef5
         ? __kthread_parkme+0xce/0xf0
         ? __pfx_cifs_demultiplex_thread+0x10/0x10 [cifs]
         kthread+0x18d/0x1d0
         ? kthread+0xdb/0x1d0
         ? __pfx_kthread+0x10/0x10
         ret_from_fork+0x34/0x60
         ? __pfx_kthread+0x10/0x10
         ret_from_fork_asm+0x1b/0x30
         </TASK>
      
      This fixes CVE-2023-6606.
      
      Reported-by: default avatar <j51569436@gmail.com>
      Closes: https://bugzilla.kernel.org/show_bug.cgi?id=218218
      
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarPaulo Alcantara (SUSE) <pc@manguebit.com>
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c60e10d1
    • Paulo Alcantara's avatar
      smb: client: fix OOB in SMB2_query_info_init() · bef4315f
      Paulo Alcantara authored
      commit 33eae65c upstream.
      
      A small CIFS buffer (448 bytes) isn't big enough to hold
      SMB2_QUERY_INFO request along with user's input data from
      CIFS_QUERY_INFO ioctl.  That is, if the user passed an input buffer >
      344 bytes, the client will memcpy() off the end of @req->Buffer in
      SMB2_query_info_init() thus causing the following KASAN splat:
      
        BUG: KASAN: slab-out-of-bounds in SMB2_query_info_init+0x242/0x250 [cifs]
        Write of size 1023 at addr ffff88801308c5a8 by task a.out/1240
      
        CPU: 1 PID: 1240 Comm: a.out Not tainted 6.7.0-rc4 #5
        Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS
        rel-1.16.2-3-gd478f380-rebuilt.opensuse.org 04/01/2014
        Call Trace:
         <TASK>
         dump_stack_lvl+0x4a/0x80
         print_report+0xcf/0x650
         ? srso_alias_return_thunk+0x5/0xfbef5
         ? srso_alias_return_thunk+0x5/0xfbef5
         ? srso_alias_return_thunk+0x5/0xfbef5
         ? __phys_addr+0x46/0x90
         kasan_report+0xd8/0x110
         ? SMB2_query_info_init+0x242/0x250 [cifs]
         ? SMB2_query_info_init+0x242/0x250 [cifs]
         kasan_check_range+0x105/0x1b0
         __asan_memcpy+0x3c/0x60
         SMB2_query_info_init+0x242/0x250 [cifs]
         ? __pfx_SMB2_query_info_init+0x10/0x10 [cifs]
         ? srso_alias_return_thunk+0x5/0xfbef5
         ? smb_rqst_len+0xa6/0xc0 [cifs]
         smb2_ioctl_query_info+0x4f4/0x9a0 [cifs]
         ? __pfx_smb2_ioctl_query_info+0x10/0x10 [cifs]
         ? __pfx_cifsConvertToUTF16+0x10/0x10 [cifs]
         ? kasan_set_track+0x25/0x30
         ? srso_alias_return_thunk+0x5/0xfbef5
         ? __kasan_kmalloc+0x8f/0xa0
         ? srso_alias_return_thunk+0x5/0xfbef5
         ? cifs_strndup_to_utf16+0x12d/0x1a0 [cifs]
         ? __build_path_from_dentry_optional_prefix+0x19d/0x2d0 [cifs]
         ? __pfx_smb2_ioctl_query_info+0x10/0x10 [cifs]
         cifs_ioctl+0x11c7/0x1de0 [cifs]
         ? __pfx_cifs_ioctl+0x10/0x10 [cifs]
         ? srso_alias_return_thunk+0x5/0xfbef5
         ? rcu_is_watching+0x23/0x50
         ? srso_alias_return_thunk+0x5/0xfbef5
         ? __rseq_handle_notify_resume+0x6cd/0x850
         ? __pfx___schedule+0x10/0x10
         ? blkcg_iostat_update+0x250/0x290
         ? srso_alias_return_thunk+0x5/0xfbef5
         ? ksys_write+0xe9/0x170
         __x64_sys_ioctl+0xc9/0x100
         do_syscall_64+0x47/0xf0
         entry_SYSCALL_64_after_hwframe+0x6f/0x77
        RIP: 0033:0x7f893dde49cf
        Code: 00 48 89 44 24 18 31 c0 48 8d 44 24 60 c7 04 24 10 00 00 00 48
        89 44 24 08 48 8d 44 24 20 48 89 44 24 10 b8 10 00 00 00 0f 05 <89>
        c2 3d 00 f0 ff ff 77 18 48 8b 44 24 18 64 48 2b 04 25 28 00 00
        RSP: 002b:00007ffc03ff4160 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
        RAX: ffffffffffffffda RBX: 00007ffc03ff4378 RCX: 00007f893dde49cf
        RDX: 00007ffc03ff41d0 RSI: 00000000c018cf07 RDI: 0000000000000003
        RBP: 00007ffc03ff4260 R08: 0000000000000410 R09: 0000000000000001
        R10: 00007f893dce7300 R11: 0000000000000246 R12: 0000000000000000
        R13: 00007ffc03ff4388 R14: 00007f893df15000 R15: 0000000000406de0
         </TASK>
      
      Fix this by increasing size of SMB2_QUERY_INFO request buffers and
      validating input length to prevent other callers from overflowing @req
      in SMB2_query_info_init() as well.
      
      Fixes: f5b05d62
      
       ("cifs: add IOCTL for QUERY_INFO passthrough to userspace")
      Cc: stable@vger.kernel.org
      Reported-by: default avatarRobert Morris <rtm@csail.mit.edu>
      Signed-off-by: default avatarPaulo Alcantara <pc@manguebit.com>
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      bef4315f
    • Paulo Alcantara's avatar
      smb: client: fix potential OOB in cifs_dump_detail() · 71fe685b
      Paulo Alcantara authored
      commit b50492b0
      
       upstream.
      
      Validate SMB message with ->check_message() before calling
      ->calc_smb_size().
      
      Signed-off-by: default avatarPaulo Alcantara (SUSE) <pc@manguebit.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      71fe685b
    • Paulo Alcantara's avatar
      smb: client: fix OOB in cifsd when receiving compounded resps · 277832a3
      Paulo Alcantara authored
      commit a8f68b11 upstream.
      
      Validate next header's offset in ->next_header() so that it isn't
      smaller than MID_HEADER_SIZE(server) and then standard_receive3() or
      ->receive() ends up writing off the end of the buffer because
      'pdu_length - MID_HEADER_SIZE(server)' wraps up to a huge length:
      
        BUG: KASAN: slab-out-of-bounds in _copy_to_iter+0x4fc/0x840
        Write of size 701 at addr ffff88800caf407f by task cifsd/1090
      
        CPU: 0 PID: 1090 Comm: cifsd Not tainted 6.7.0-rc4 #5
        Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS
        rel-1.16.2-3-gd478f380-rebuilt.opensuse.org 04/01/2014
        Call Trace:
         <TASK>
         dump_stack_lvl+0x4a/0x80
         print_report+0xcf/0x650
         ? srso_alias_return_thunk+0x5/0xfbef5
         ? srso_alias_return_thunk+0x5/0xfbef5
         ? __phys_addr+0x46/0x90
         kasan_report+0xd8/0x110
         ? _copy_to_iter+0x4fc/0x840
         ? _copy_to_iter+0x4fc/0x840
         kasan_check_range+0x105/0x1b0
         __asan_memcpy+0x3c/0x60
         _copy_to_iter+0x4fc/0x840
         ? srso_alias_return_thunk+0x5/0xfbef5
         ? hlock_class+0x32/0xc0
         ? srso_alias_return_thunk+0x5/0xfbef5
         ? __pfx__copy_to_iter+0x10/0x10
         ? srso_alias_return_thunk+0x5/0xfbef5
         ? lock_is_held_type+0x90/0x100
         ? srso_alias_return_thunk+0x5/0xfbef5
         ? __might_resched+0x278/0x360
         ? __pfx___might_resched+0x10/0x10
         ? srso_alias_return_thunk+0x5/0xfbef5
         __skb_datagram_iter+0x2c2/0x460
         ? __pfx_simple_copy_to_iter+0x10/0x10
         skb_copy_datagram_iter+0x6c/0x110
         tcp_recvmsg_locked+0x9be/0xf40
         ? __pfx_tcp_recvmsg_locked+0x10/0x10
         ? mark_held_locks+0x5d/0x90
         ? srso_alias_return_thunk+0x5/0xfbef5
         tcp_recvmsg+0xe2/0x310
         ? __pfx_tcp_recvmsg+0x10/0x10
         ? srso_alias_return_thunk+0x5/0xfbef5
         ? srso_alias_return_thunk+0x5/0xfbef5
         ? lock_acquire+0x14a/0x3a0
         ? srso_alias_return_thunk+0x5/0xfbef5
         inet_recvmsg+0xd0/0x370
         ? __pfx_inet_recvmsg+0x10/0x10
         ? __pfx_lock_release+0x10/0x10
         ? do_raw_spin_trylock+0xd1/0x120
         sock_recvmsg+0x10d/0x150
         cifs_readv_from_socket+0x25a/0x490 [cifs]
         ? __pfx_cifs_readv_from_socket+0x10/0x10 [cifs]
         ? srso_alias_return_thunk+0x5/0xfbef5
         cifs_read_from_socket+0xb5/0x100 [cifs]
         ? __pfx_cifs_read_from_socket+0x10/0x10 [cifs]
         ? __pfx_lock_release+0x10/0x10
         ? do_raw_spin_trylock+0xd1/0x120
         ? _raw_spin_unlock+0x23/0x40
         ? srso_alias_return_thunk+0x5/0xfbef5
         ? __smb2_find_mid+0x126/0x230 [cifs]
         cifs_demultiplex_thread+0xd39/0x1270 [cifs]
         ? __pfx_cifs_demultiplex_thread+0x10/0x10 [cifs]
         ? __pfx_lock_release+0x10/0x10
         ? srso_alias_return_thunk+0x5/0xfbef5
         ? mark_held_locks+0x1a/0x90
         ? lockdep_hardirqs_on_prepare+0x136/0x210
         ? srso_alias_return_thunk+0x5/0xfbef5
         ? srso_alias_return_thunk+0x5/0xfbef5
         ? __kthread_parkme+0xce/0xf0
         ? __pfx_cifs_demultiplex_thread+0x10/0x10 [cifs]
         kthread+0x18d/0x1d0
         ? kthread+0xdb/0x1d0
         ? __pfx_kthread+0x10/0x10
         ret_from_fork+0x34/0x60
         ? __pfx_kthread+0x10/0x10
         ret_from_fork_asm+0x1b/0x30
         </TASK>
      
      Fixes: 8ce79ec3
      
       ("cifs: update multiplex loop to handle compounded responses")
      Cc: stable@vger.kernel.org
      Reported-by: default avatarRobert Morris <rtm@csail.mit.edu>
      Signed-off-by: default avatarPaulo Alcantara (SUSE) <pc@manguebit.com>
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      277832a3
    • Fabio Estevam's avatar
      dt-bindings: nvmem: mxs-ocotp: Document fsl,ocotp · 3f6da210
      Fabio Estevam authored
      commit a2a8aefe upstream.
      
      Both imx23.dtsi and imx28.dtsi describe the OCOTP nodes in
      the format:
      
      compatible = "fsl,imx28-ocotp", "fsl,ocotp";
      
      Document the "fsl,ocotp" entry to fix the following schema
      warning:
      
      efuse@8002c000: compatible: ['fsl,imx23-ocotp', 'fsl,ocotp'] is too long
      from schema $id: http://devicetree.org/schemas/nvmem/mxs-ocotp.yaml#
      
      Fixes: 2c504460
      
       ("dt-bindings: nvmem: Convert MXS OCOTP to json-schema")
      Cc:  <Stable@vger.kernel.org>
      Signed-off-by: default avatarFabio Estevam <festevam@denx.de>
      Acked-by: default avatarConor Dooley <conor.dooley@microchip.com>
      Signed-off-by: default avatarSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
      Link: https://lore.kernel.org/r/20231215111358.316727-2-srinivas.kandagatla@linaro.org
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3f6da210
    • Ronald Wahl's avatar
      net: ks8851: Fix TX stall caused by TX buffer overrun · 10925251
      Ronald Wahl authored
      commit 3dc5d445 upstream.
      
      There is a bug in the ks8851 Ethernet driver that more data is written
      to the hardware TX buffer than actually available. This is caused by
      wrong accounting of the free TX buffer space.
      
      The driver maintains a tx_space variable that represents the TX buffer
      space that is deemed to be free. The ks8851_start_xmit_spi() function
      adds an SKB to a queue if tx_space is large enough and reduces tx_space
      by the amount of buffer space it will later need in the TX buffer and
      then schedules a work item. If there is not enough space then the TX
      queue is stopped.
      
      The worker function ks8851_tx_work() dequeues all the SKBs and writes
      the data into the hardware TX buffer. The last packet will trigger an
      interrupt after it was send. Here it is assumed that all data fits into
      the TX buffer.
      
      In the interrupt routine (which runs asynchronously because it is a
      threaded interrupt) tx_space is updated with the current value from the
      hardware. Also the TX queue is woken up again.
      
      Now it could happen that after data was sent to the hardware and before
      handling the TX interrupt new data is queued in ks8851_start_xmit_spi()
      when the TX buffer space had still some space left. When the interrupt
      is actually handled tx_space is updated from the hardware but now we
      already have new SKBs queued that have not been written to the hardware
      TX buffer yet. Since tx_space has been overwritten by the value from the
      hardware the space is not accounted for.
      
      Now we have more data queued then buffer space available in the hardware
      and ks8851_tx_work() will potentially overrun the hardware TX buffer. In
      many cases it will still work because often the buffer is written out
      fast enough so that no overrun occurs but for example if the peer
      throttles us via flow control then an overrun may happen.
      
      This can be fixed in different ways. The most simple way would be to set
      tx_space to 0 before writing data to the hardware TX buffer preventing
      the queuing of more SKBs until the TX interrupt has been handled. I have
      chosen a slightly more efficient (and still rather simple) way and
      track the amount of data that is already queued and not yet written to
      the hardware. When new SKBs are to be queued the already queued amount
      of data is honoured when checking free TX buffer space.
      
      I tested this with a setup of two linked KS8851 running iperf3 between
      the two in bidirectional mode. Before the fix I got a stall after some
      minutes. With the fix I saw now issues anymore after hours.
      
      Fixes: 3ba81f3e
      
       ("net: Micrel KS8851 SPI network driver")
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Eric Dumazet <edumazet@google.com>
      Cc: Jakub Kicinski <kuba@kernel.org>
      Cc: Paolo Abeni <pabeni@redhat.com>
      Cc: Ben Dooks <ben.dooks@codethink.co.uk>
      Cc: Tristram Ha <Tristram.Ha@microchip.com>
      Cc: netdev@vger.kernel.org
      Cc: stable@vger.kernel.org # 5.10+
      Signed-off-by: default avatarRonald Wahl <ronald.wahl@raritan.com>
      Reviewed-by: default avatarSimon Horman <horms@kernel.org>
      Link: https://lore.kernel.org/r/20231214181112.76052-1-rwahl@gmx.de
      
      
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      10925251
    • Rouven Czerwinski's avatar
      net: rfkill: gpio: set GPIO direction · e9df9f08
      Rouven Czerwinski authored
      commit 23484d81 upstream.
      
      Fix the undefined usage of the GPIO consumer API after retrieving the
      GPIO description with GPIO_ASIS. The API documentation mentions that
      GPIO_ASIS won't set a GPIO direction and requires the user to set a
      direction before using the GPIO.
      
      This can be confirmed on i.MX6 hardware, where rfkill-gpio is no longer
      able to enabled/disable a device, presumably because the GPIO controller
      was never configured for the output direction.
      
      Fixes: b2f750c3
      
       ("net: rfkill: gpio: prevent value glitch during probe")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarRouven Czerwinski <r.czerwinski@pengutronix.de>
      Link: https://msgid.link/20231207075835.3091694-1-r.czerwinski@pengutronix.de
      
      
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e9df9f08
    • Fedor Pchelkin's avatar
      net: 9p: avoid freeing uninit memory in p9pdu_vreadf · 80561115
      Fedor Pchelkin authored
      commit ff49bf18 upstream.
      
      If some of p9pdu_readf() calls inside case 'T' in p9pdu_vreadf() fails,
      the error path is not handled properly. *wnames or members of *wnames
      array may be left uninitialized and invalidly freed.
      
      Initialize *wnames to NULL in beginning of case 'T'. Initialize the first
      *wnames array element to NULL and nullify the failing *wnames element so
      that the error path freeing loop stops on the first NULL element and
      doesn't proceed further.
      
      Found by Linux Verification Center (linuxtesting.org).
      
      Fixes: ace51c4d
      
       ("9p: add new protocol support code")
      Signed-off-by: default avatarFedor Pchelkin <pchelkin@ispras.ru>
      Message-ID: <20231206200913.16135-1-pchelkin@ispras.ru>
      Cc: stable@vger.kernel.org
      Reviewed-by: default avatarSimon Horman <horms@kernel.org>
      Reviewed-by: default avatarChristian Schoenebeck <linux_oss@crudebyte.com>
      Signed-off-by: default avatarDominique Martinet <asmadeus@codewreck.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      80561115
    • Christoffer Sandberg's avatar
      Input: soc_button_array - add mapping for airplane mode button · 4c775b4c
      Christoffer Sandberg authored
      commit ea371594
      
       upstream.
      
      This add a mapping for the airplane mode button on the TUXEDO Pulse Gen3.
      
      While it is physically a key it behaves more like a switch, sending a key
      down on first press and a key up on 2nd press. Therefor the switch event
      is used here. Besides this behaviour it uses the HID usage-id 0xc6
      (Wireless Radio Button) and not 0xc8 (Wireless Radio Slider Switch), but
      since neither 0xc6 nor 0xc8 are currently implemented at all in
      soc_button_array this not to standard behaviour is not put behind a quirk
      for the moment.
      
      Signed-off-by: default avatarChristoffer Sandberg <cs@tuxedo.de>
      Signed-off-by: default avatarWerner Sembach <wse@tuxedocomputers.com>
      Link: https://lore.kernel.org/r/20231215171718.80229-1-wse@tuxedocomputers.com
      
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4c775b4c
    • Jose Ignacio Tornos Martinez's avatar
      net: usb: ax88179_178a: avoid failed operations when device is disconnected · 5df2b49e
      Jose Ignacio Tornos Martinez authored
      commit aef05e34 upstream.
      
      When the device is disconnected we get the following messages showing
      failed operations:
      Nov 28 20:22:11 localhost kernel: usb 2-3: USB disconnect, device number 2
      Nov 28 20:22:11 localhost kernel: ax88179_178a 2-3:1.0 enp2s0u3: unregister 'ax88179_178a' usb-0000:02:00.0-3, ASIX AX88179 USB 3.0 Gigabit Ethernet
      Nov 28 20:22:11 localhost kernel: ax88179_178a 2-3:1.0 enp2s0u3: Failed to read reg index 0x0002: -19
      Nov 28 20:22:11 localhost kernel: ax88179_178a 2-3:1.0 enp2s0u3: Failed to write reg index 0x0002: -19
      Nov 28 20:22:11 localhost kernel: ax88179_178a 2-3:1.0 enp2s0u3 (unregistered): Failed to write reg index 0x0002: -19
      Nov 28 20:22:11 localhost kernel: ax88179_178a 2-3:1.0 enp2s0u3 (unregistered): Failed to write reg index 0x0001: -19
      Nov 28 20:22:11 localhost kernel: ax88179_178a 2-3:1.0 enp2s0u3 (unregistered): Failed to write reg index 0x0002: -19
      
      The reason is that although the device is detached, normal stop and
      unbind operations are commanded from the driver. These operations are
      not necessary in this situation, so avoid these logs when the device is
      detached if the result of the operation is -ENODEV and if the new flag
      informing about the disconnecting status is enabled.
      
      cc:  <stable@vger.kernel.org>
      Fixes: e2ca90c2
      
       ("ax88179_178a: ASIX AX88179_178A USB 3.0/2.0 to gigabit ethernet adapter driver")
      Signed-off-by: default avatarJose Ignacio Tornos Martinez <jtornosm@redhat.com>
      Acked-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Link: https://lore.kernel.org/r/20231207175007.263907-1-jtornosm@redhat.com
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5df2b49e
    • Alex Lu's avatar
      Bluetooth: Add more enc key size check · 0f7bffd4
      Alex Lu authored
      commit 04a342cc
      
       upstream.
      
      When we are slave role and receives l2cap conn req when encryption has
      started, we should check the enc key size to avoid KNOB attack or BLUFFS
      attack.
      From SIG recommendation, implementations are advised to reject
      service-level connections on an encrypted baseband link with key
      strengths below 7 octets.
      A simple and clear way to achieve this is to place the enc key size
      check in hci_cc_read_enc_key_size()
      
      The btmon log below shows the case that lacks enc key size check.
      
      > HCI Event: Connect Request (0x04) plen 10
              Address: BB:22:33:44:55:99 (OUI BB-22-33)
              Class: 0x480104
                Major class: Computer (desktop, notebook, PDA, organizers)
                Minor class: Desktop workstation
                Capturing (Scanner, Microphone)
                Telephony (Cordless telephony, Modem, Headset)
              Link type: ACL (0x01)
      < HCI Command: Accept Connection Request (0x01|0x0009) plen 7
              Address: BB:22:33:44:55:99 (OUI BB-22-33)
              Role: Peripheral (0x01)
      > HCI Event: Command Status (0x0f) plen 4
            Accept Connection Request (0x01|0x0009) ncmd 2
              Status: Success (0x00)
      > HCI Event: Connect Complete (0x03) plen 11
              Status: Success (0x00)
              Handle: 1
              Address: BB:22:33:44:55:99 (OUI BB-22-33)
              Link type: ACL (0x01)
              Encryption: Disabled (0x00)
      ...
      
      > HCI Event: Encryption Change (0x08) plen 4
              Status: Success (0x00)
              Handle: 1 Address: BB:22:33:44:55:99 (OUI BB-22-33)
              Encryption: Enabled with E0 (0x01)
      < HCI Command: Read Encryption Key Size (0x05|0x0008) plen 2
              Handle: 1 Address: BB:22:33:44:55:99 (OUI BB-22-33)
      > HCI Event: Command Complete (0x0e) plen 7
            Read Encryption Key Size (0x05|0x0008) ncmd 2
              Status: Success (0x00)
              Handle: 1 Address: BB:22:33:44:55:99 (OUI BB-22-33)
              Key size: 6
      // We should check the enc key size
      ...
      
      > ACL Data RX: Handle 1 flags 0x02 dlen 12
            L2CAP: Connection Request (0x02) ident 3 len 4
              PSM: 25 (0x0019)
              Source CID: 64
      < ACL Data TX: Handle 1 flags 0x00 dlen 16
            L2CAP: Connection Response (0x03) ident 3 len 8
              Destination CID: 64
              Source CID: 64
              Result: Connection pending (0x0001)
              Status: Authorization pending (0x0002)
      > HCI Event: Number of Completed Packets (0x13) plen 5
              Num handles: 1
              Handle: 1 Address: BB:22:33:44:55:99 (OUI BB-22-33)
              Count: 1
              #35: len 16 (25 Kb/s)
              Latency: 5 msec (2-7 msec ~4 msec)
      < ACL Data TX: Handle 1 flags 0x00 dlen 16
            L2CAP: Connection Response (0x03) ident 3 len 8
              Destination CID: 64
              Source CID: 64
              Result: Connection successful (0x0000)
              Status: No further information available (0x0000)
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarAlex Lu <alex_lu@realsil.com.cn>
      Signed-off-by: default avatarMax Chou <max.chou@realtek.com>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0f7bffd4
    • Xiao Yao's avatar
      Bluetooth: MGMT/SMP: Fix address type when using SMP over BREDR/LE · 39347d64
      Xiao Yao authored
      commit 59b047bc
      
       upstream.
      
      If two Bluetooth devices both support BR/EDR and BLE, and also
      support Secure Connections, then they only need to pair once.
      The LTK generated during the LE pairing process may be converted
      into a BR/EDR link key for BR/EDR transport, and conversely, a
      link key generated during the BR/EDR SSP pairing process can be
      converted into an LTK for LE transport. Hence, the link type of
      the link key and LTK is not fixed, they can be either an LE LINK
      or an ACL LINK.
      
      Currently, in the mgmt_new_irk/ltk/crsk/link_key functions, the
      link type is fixed, which could lead to incorrect address types
      being reported to the application layer. Therefore, it is necessary
      to add link_type/addr_type to the smp_irk/ltk/crsk and link_key,
      to ensure the generation of the correct address type.
      
      SMP over BREDR:
      Before Fix:
      > ACL Data RX: Handle 11 flags 0x02 dlen 12
              BR/EDR SMP: Identity Address Information (0x09) len 7
              Address: F8:7D:76:F2:12:F3 (OUI F8-7D-76)
      @ MGMT Event: New Identity Resolving Key (0x0018) plen 30
              Random address: 00:00:00:00:00:00 (Non-Resolvable)
              LE Address: F8:7D:76:F2:12:F3 (OUI F8-7D-76)
      @ MGMT Event: New Long Term Key (0x000a) plen 37
              LE Address: F8:7D:76:F2:12:F3 (OUI F8-7D-76)
              Key type: Authenticated key from P-256 (0x03)
      
      After Fix:
      > ACL Data RX: Handle 11 flags 0x02 dlen 12
            BR/EDR SMP: Identity Address Information (0x09) len 7
              Address: F8:7D:76:F2:12:F3 (OUI F8-7D-76)
      @ MGMT Event: New Identity Resolving Key (0x0018) plen 30
              Random address: 00:00:00:00:00:00 (Non-Resolvable)
              BR/EDR Address: F8:7D:76:F2:12:F3 (OUI F8-7D-76)
      @ MGMT Event: New Long Term Key (0x000a) plen 37
              BR/EDR Address: F8:7D:76:F2:12:F3 (OUI F8-7D-76)
              Key type: Authenticated key from P-256 (0x03)
      
      SMP over LE:
      Before Fix:
      @ MGMT Event: New Identity Resolving Key (0x0018) plen 30
              Random address: 5F:5C:07:37:47:D5 (Resolvable)
              LE Address: F8:7D:76:F2:12:F3 (OUI F8-7D-76)
      @ MGMT Event: New Long Term Key (0x000a) plen 37
              LE Address: F8:7D:76:F2:12:F3 (OUI F8-7D-76)
              Key type: Authenticated key from P-256 (0x03)
      @ MGMT Event: New Link Key (0x0009) plen 26
              BR/EDR Address: F8:7D:76:F2:12:F3 (OUI F8-7D-76)
              Key type: Authenticated Combination key from P-256 (0x08)
      
      After Fix:
      @ MGMT Event: New Identity Resolving Key (0x0018) plen 30
              Random address: 5E:03:1C:00:38:21 (Resolvable)
              LE Address: F8:7D:76:F2:12:F3 (OUI F8-7D-76)
      @ MGMT Event: New Long Term Key (0x000a) plen 37
              LE Address: F8:7D:76:F2:12:F3 (OUI F8-7D-76)
              Key type: Authenticated key from P-256 (0x03)
      @ MGMT Event: New Link Key (0x0009) plen 26
              Store hint: Yes (0x01)
              LE Address: F8:7D:76:F2:12:F3 (OUI F8-7D-76)
              Key type: Authenticated Combination key from P-256 (0x08)
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarXiao Yao <xiaoyao@rock-chips.com>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      39347d64
    • Frédéric Danis's avatar
      Bluetooth: L2CAP: Send reject on command corrupted request · e14a7eba
      Frédéric Danis authored
      commit 78b99eb1
      
       upstream.
      
      L2CAP/COS/CED/BI-02-C PTS test send a malformed L2CAP signaling packet
      with 2 commands in it (a connection request and an unknown command) and
      expect to get a connection response packet and a command reject packet.
      The second is currently not sent.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarFrédéric Danis <frederic.danis@collabora.com>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e14a7eba
    • Hyunwoo Kim's avatar
      Bluetooth: af_bluetooth: Fix Use-After-Free in bt_sock_recvmsg · 37f71e2c
      Hyunwoo Kim authored
      commit 2e07e834 upstream.
      
      This can cause a race with bt_sock_ioctl() because
      bt_sock_recvmsg() gets the skb from sk->sk_receive_queue
      and then frees it without holding lock_sock.
      A use-after-free for a skb occurs with the following flow.
      ```
      bt_sock_recvmsg() -> skb_recv_datagram() -> skb_free_datagram()
      bt_sock_ioctl() -> skb_peek()
      ```
      Add lock_sock to bt_sock_recvmsg() to fix this issue.
      
      Cc: stable@vger.kernel.org
      Fixes: 1da177e4
      
       ("Linux-2.6.12-rc2")
      Signed-off-by: default avatarHyunwoo Kim <v4bel@theori.io>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      37f71e2c
    • Luiz Augusto von Dentz's avatar
      Bluetooth: hci_event: Fix not checking if HCI_OP_INQUIRY has been sent · 470896ec
      Luiz Augusto von Dentz authored
      commit 99e67d46 upstream.
      
      Before setting HCI_INQUIRY bit check if HCI_OP_INQUIRY was really sent
      otherwise the controller maybe be generating invalid events or, more
      likely, it is a result of fuzzing tools attempting to test the right
      behavior of the stack when unexpected events are generated.
      
      Cc: stable@vger.kernel.org
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=218151
      
      
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      470896ec
    • Clément Villeret's avatar
      ALSA: hda/realtek: Add quirk for ASUS ROG GV302XA · d36d945f
      Clément Villeret authored
      commit 02a460ad
      
       upstream.
      
      Asus ROG Flowx13 (GV302XA) seems require same patch as others asus products
      
      Signed-off-by: default avatarClément Villeret <clement.villeret@gmail.com>
      Cc: <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/0a27bf4b-3056-49ac-9651-ebd7f3e36328@gmail.com
      
      
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d36d945f
    • Reinhard Speyerer's avatar
      USB: serial: option: add Quectel RM500Q R13 firmware support · 9599a5e3
      Reinhard Speyerer authored
      commit 06f22cd6
      
       upstream.
      
      Add support for Quectel RM500Q R13 firmware which uses Prot=40 for the
      NMEA port:
      
      T:  Bus=02 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#=  8 Spd=5000 MxCh= 0
      D:  Ver= 3.20 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 9 #Cfgs=  1
      P:  Vendor=2c7c ProdID=0800 Rev= 4.14
      S:  Manufacturer=Quectel
      S:  Product=RM500Q-AE
      S:  SerialNumber=xxxxxxxx
      C:* #Ifs= 5 Cfg#= 1 Atr=a0 MxPwr=896mA
      I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
      E:  Ad=81(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      E:  Ad=01(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      I:* If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=40 Driver=option
      E:  Ad=83(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      E:  Ad=82(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      E:  Ad=02(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=85(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      E:  Ad=84(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      E:  Ad=03(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      I:* If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=87(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      E:  Ad=86(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      E:  Ad=04(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      I:* If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan
      E:  Ad=88(I) Atr=03(Int.) MxPS=   8 Ivl=32ms
      E:  Ad=8e(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      E:  Ad=0f(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      
      Signed-off-by: default avatarReinhard Speyerer <rspmn@arcor.de>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9599a5e3
    • Slark Xiao's avatar
      USB: serial: option: add Foxconn T99W265 with new baseline · a91fb450
      Slark Xiao authored
      commit 13fde9ac
      
       upstream.
      
      This ID was added based on latest SDX12 code base line, and we
      made some changes with previous 0489:e0db.
      
      Test evidence as below:
      T:  Bus=02 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  3 Spd=5000 MxCh= 0
      D:  Ver= 3.20 Cls=ef(misc ) Sub=02 Prot=01 MxPS= 9 #Cfgs=  2
      P:  Vendor=0489 ProdID=e0da Rev=05.04
      S:  Manufacturer=Qualcomm
      S:  Product=Qualcomm Snapdragon X12
      S:  SerialNumber=2bda65fb
      C:  #Ifs= 6 Cfg#= 2 Atr=a0 MxPwr=896mA
      I:  If#=0x0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=0e Prot=00 Driver=cdc_mbim
      I:  If#=0x1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
      I:  If#=0x2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
      I:  If#=0x3 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
      I:  If#=0x4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
      I:  If#=0x5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=(none)
      
      0&1: MBIM, 2: Modem, 3:GNSS, 4:Diag, 5:ADB
      
      Signed-off-by: default avatarSlark Xiao <slark_xiao@163.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a91fb450
    • Alper Ak's avatar
      USB: serial: option: add Quectel EG912Y module support · 73b6b6ab
      Alper Ak authored
      commit 6d79d943
      
       upstream.
      
      Add Quectel EG912Y "DIAG, AT, MODEM"
      
      0x6001: ECM / RNDIS + DIAG + AT + MODEM
      
      T:  Bus=01 Lev=02 Prnt=02 Port=00 Cnt=01 Dev#=  3 Spd=480  MxCh= 0
      D:  Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
      P:  Vendor=2c7c ProdID=6001 Rev= 3.18
      S:  Manufacturer=Android
      S:  Product=Android
      S:  SerialNumber=0000
      C:* #Ifs= 5 Cfg#= 1 Atr=e0 MxPwr=500mA
      A:  FirstIf#= 0 IfCount= 2 Cls=02(comm.) Sub=06 Prot=00
      I:* If#= 0 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=06 Prot=00 Driver=cdc_ether
      E:  Ad=87(I) Atr=03(Int.) MxPS=  64 Ivl=4096ms
      I:  If#= 1 Alt= 0 #EPs= 0 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_ether
      I:* If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_ether
      E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=0c(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=0b(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=89(I) Atr=03(Int.) MxPS=  64 Ivl=4096ms
      E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=0f(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=88(I) Atr=03(Int.) MxPS=  64 Ivl=4096ms
      E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=0a(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      
      Signed-off-by: default avatarAlper Ak <alperyasinak1@gmail.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      73b6b6ab
    • Mark Glover's avatar
      USB: serial: ftdi_sio: update Actisense PIDs constant names · 9b968a70
      Mark Glover authored
      commit 513d88a8
      
       upstream.
      
      Update the constant names for unused USB PIDs (product identifiers) to
      reflect the new products now using the PIDs.
      
      Signed-off-by: default avatarMark Glover <mark.glover@actisense.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9b968a70
    • Johannes Berg's avatar
      wifi: cfg80211: fix certs build to not depend on file order · db57ef0d
      Johannes Berg authored
      commit 3c2a8ebe
      
       upstream.
      
      The file for the new certificate (Chen-Yu Tsai's) didn't
      end with a comma, so depending on the file order in the
      build rule, we'd end up with invalid C when concatenating
      the (now two) certificates. Fix that.
      
      Cc: stable@vger.kernel.org
      Reported-by: default avatarBiju Das <biju.das.jz@bp.renesas.com>
      Reported-by: default avatarNaresh Kamboju <naresh.kamboju@linaro.org>
      Fixes: fb768d3b
      
       ("wifi: cfg80211: Add my certificate")
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      db57ef0d
    • Chen-Yu Tsai's avatar
      wifi: cfg80211: Add my certificate · ec350809
      Chen-Yu Tsai authored
      commit fb768d3b upstream.
      
      As announced [1][2], I have taken over maintainership of the
      wireless-regdb project.
      
      Add my certificate so that newer releases are valid to the kernel.
      Seth's certificate should be kept around for awhile, at least until
      a few new releases by me happen.
      
      This should also be applied to stable trees so that stable kernels
      can utilize newly released database binaries.
      
      [1] https://lore.kernel.org/linux-wireless/CAGb2v657baNMPKU3QADijx7hZa=GUcSv2LEDdn6N=QQaFX8r-g@mail.gmail.com/
      [2] https://lore.kernel.org/linux-wireless/ZWmRR5ul7EDfxCan@wens.tw/
      
      
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarChen-Yu Tsai <wens@kernel.org>
      Acked-by: default avatarSeth Forshee <sforshee@kernel.org>
      Link: https://msgid.link/ZXHGsqs34qZyzZng@wens.tw
      
      
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ec350809
    • Tasos Sahanidis's avatar
      usb-storage: Add quirk for incorrect WP on Kingston DT Ultimate 3.0 G3 · 228d9960
      Tasos Sahanidis authored
      commit 772685c1 upstream.
      
      This flash drive reports write protect during the first mode sense.
      
      In the past this was not an issue as the kernel called revalidate twice,
      thus asking the device for its write protect status twice, with write
      protect being disabled in the second mode sense.
      
      However, since commit 1e029397 ("scsi: sd: Reorganize DIF/DIX code to
      avoid calling revalidate twice") that is no longer the case, thus the
      device shows up read only.
      
      [490891.289495] sd 12:0:0:0: [sdl] Write Protect is on
      [490891.289497] sd 12:0:0:0: [sdl] Mode Sense: 2b 00 80 08
      
      This does not appear to be a timing issue, as enabling the usbcore quirk
      USB_QUIRK_DELAY_INIT has no effect on write protect.
      
      Fixes: 1e029397
      
       ("scsi: sd: Reorganize DIF/DIX code to avoid calling revalidate twice")
      Cc: stable <stable@kernel.org>
      Signed-off-by: default avatarTasos Sahanidis <tasos@tasossah.com>
      Acked-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Reviewed-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Link: https://lore.kernel.org/r/20231207134441.298131-1-tasos@tasossah.com
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      228d9960
    • Jeremie Knuesel's avatar
      ALSA: usb-audio: Increase delay in MOTU M quirk · 82f91372
      Jeremie Knuesel authored
      commit 48d6b917
      
       upstream.
      
      Increase the quirk delay from 2 seconds to 4 seconds. This reflects a
      change in the Windows driver in which the delay was increased to about
      3.7 seconds. The larger delay fixes an issue where the device fails to
      work unless it was powered up early during boot.
      
      Also clarify in the quirk comment that the quirk is only applied to
      older devices (USB ID 07fd:0008).
      
      Signed-off-by: default avatarJeremie Knuesel <knuesel@gmail.com>
      Suggested-by: default avatarAlexander Tsoy <alexander@tsoy.me>
      Cc: <stable@vger.kernel.org>
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=211975
      Link: https://lore.kernel.org/r/20231217112243.33409-1-knuesel@gmail.com
      
      
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      82f91372
    • David Lechner's avatar
      iio: triggered-buffer: prevent possible freeing of wrong buffer · 01bc94b5
      David Lechner authored
      commit bce61476 upstream.
      
      Commit ee708e6b ("iio: buffer: introduce support for attaching more
      IIO buffers") introduced support for multiple buffers per indio_dev but
      left indio_dev->buffer for a few legacy use cases.
      
      In the case of the triggered buffer, iio_triggered_buffer_cleanup()
      still assumes that indio_dev->buffer points to the buffer allocated by
      iio_triggered_buffer_setup_ext(). However, since
      iio_triggered_buffer_setup_ext() now calls iio_device_attach_buffer()
      to attach the buffer, indio_dev->buffer will only point to the buffer
      allocated by iio_device_attach_buffer() if it the first buffer attached.
      
      This adds a check to make sure that no other buffer has been attached
      yet to ensure that indio_dev->buffer will be assigned when
      iio_device_attach_buffer() is called.
      
      As per discussion in the review thread, we may want to deal with multiple
      triggers per device, but this is a fix for the issue in the meantime and
      any such support would be unlikely to be suitable for a backport.
      
      Fixes: ee708e6b
      
       ("iio: buffer: introduce support for attaching more IIO buffers")
      Signed-off-by: default avatarDavid Lechner <dlechner@baylibre.com>
      Acked-by: default avatarNuno Sa <nuno.sa@analog.com>
      Link: https://lore.kernel.org/r/20231031210521.1661552-1-dlechner@baylibre.com
      
      
      Cc: <Stable@vger.kernel.org>
      Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      01bc94b5
    • Wadim Egorov's avatar
      iio: adc: ti_am335x_adc: Fix return value check of tiadc_request_dma() · c508a99f
      Wadim Egorov authored
      commit 60576e84 upstream.
      
      Fix wrong handling of a DMA request where the probing only failed
      if -EPROPE_DEFER was returned. Instead, let us fail if a non -ENODEV
      value is returned. This makes DMAs explicitly optional. Even if the
      DMA request is unsuccessfully, the ADC can still work properly.
      We do also handle the defer probe case by making use of dev_err_probe().
      
      Fixes: f438b9da
      
       ("drivers: iio: ti_am335x_adc: add dma support")
      Signed-off-by: default avatarWadim Egorov <w.egorov@phytec.de>
      Reviewed-by: default avatarBhavya Kapoor <b-kapoor@ti.com>
      Link: https://lore.kernel.org/r/20230925134427.214556-1-w.egorov@phytec.de
      
      
      Cc: <Stable@vger.kernel.org>
      Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c508a99f
    • Javier Carrasco's avatar
      iio: common: ms_sensors: ms_sensors_i2c: fix humidity conversion time table · 1b670b0e
      Javier Carrasco authored
      commit 54cf39ec upstream.
      
      The HTU21 offers 4 sampling frequencies: 20, 40, 70 and 120, which are
      associated to an index that is used to select the right measurement
      resolution and its corresponding measurement time. The current
      implementation selects the measurement resolution and the temperature
      measurement time properly, but it does not select the right humidity
      measurement time in all cases.
      
      In summary, the 40 and 70 humidity measurement times are swapped.
      
      The reason for that is probably the unusual coding for the measurement
      resolution. According to the datasheet, the bits [7,0] of the "user
      register" are used as follows to select the bit resolution:
      
      --------------------------------------------------
      | Bit 7 | Bit 0 | RH | Temp | Trh (us) | Tt (us) |
      --------------------------------------------------
      |   0   |   0   | 12 |  14  |  16000   |  50000  |
      --------------------------------------------------
      |   0   |   1   | 8  |  12  |  3000    |  13000  |
      --------------------------------------------------
      |   1   |   0   | 10 |  13  |  5000    |  25000  |
      --------------------------------------------------
      |   1   |   1   | 11 |  11  |  8000    |  7000   |
      --------------------------------------------------
      *This table is available in the official datasheet, page 13/21. I have
      just appended the times provided in the humidity/temperature tables,
      pages 3/21, 5/21. Note that always a pair of resolutions is selected.
      
      The sampling frequencies [20, 40, 70, 120] are assigned to a linear
      index [0..3] which is then coded as follows [1]:
      
      Index    [7,0]
      --------------
      idx 0     0,0
      idx 1     1,0
      idx 2     0,1
      idx 3     1,1
      
      That is done that way because the temperature measurements are being
      used as the reference for the sampling frequency (the frequencies and
      the temperature measurement times are correlated), so increasing the
      index always reduces the temperature measurement time and its
      resolution. Therefore, the temperature measurement time array is as
      simple as [50000, 25000, 13000, 7000]
      
      On the other hand, the humidity resolution cannot follow the same
      pattern because of the way it is coded in the "user register", where
      both resolutions are selected at the same time. The humidity measurement
      time array is the following: [16000, 3000, 5000, 8000], which defines
      the following assignments:
      
      Index    [7,0]    Trh
      -----------------------
      idx 0     0,0     16000  -> right, [0,0] selects 12 bits (Trh = 16000)
      idx 1     1,0     3000   -> wrong! [1,0] selects 10 bits (Trh = 5000)
      idx 2     0,1     5000   -> wrong! [0,1] selects 8 bits (Trh = 3000)
      idx 3     1,1     8000   -> right, [1,1] selects 11 bits (Trh = 8000)
      
      The times have been ordered as if idx = 1 -> [0,1] and idx = 2 -> [1,0],
      which is not the case for the reason explained above.
      
      So a simple modification is required to obtain the right humidity
      measurement time array, swapping the values in the positions 1 and 2.
      
      The right table should be the following: [16000, 5000, 3000, 8000]
      
      Fix the humidity measurement time array with the right idex/value
      coding.
      
      [1] The actual code that makes this coding and assigns it to the current
      value of the "user register" is the following:
      config_reg &= 0x7E;
      config_reg |= ((i & 1) << 7) + ((i & 2) >> 1);
      
      Fixes: d574a87c
      
       ("Add meas-spec sensors common part")
      Signed-off-by: default avatarJavier Carrasco <javier.carrasco.cruz@gmail.com>
      Link: https://lore.kernel.org/r/20231026-topic-htu21_conversion_time-v1-1-bd257dc44209@gmail.com
      
      
      Cc: <Stable@vger.kernel.org>
      Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1b670b0e
    • Wei Yongjun's avatar
      scsi: bnx2fc: Fix skb double free in bnx2fc_rcv() · 1fe4c93f
      Wei Yongjun authored
      [ Upstream commit 08c94d80 ]
      
      skb_share_check() already drops the reference to the skb when returning
      NULL. Using kfree_skb() in the error handling path leads to an skb double
      free.
      
      Fix this by removing the variable tmp_skb, and return directly when
      skb_share_check() returns NULL.
      
      Fixes: 01a4cc4d
      
       ("bnx2fc: do not add shared skbs to the fcoe_rx_list")
      Signed-off-by: default avatarWei Yongjun <weiyongjun1@huawei.com>
      Link: https://lore.kernel.org/r/20221114110626.526643-1-weiyongjun@huaweicloud.com
      
      
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      1fe4c93f
    • Haoran Liu's avatar
      Input: ipaq-micro-keys - add error handling for devm_kmemdup · 66ccf5f7
      Haoran Liu authored
      [ Upstream commit 59b6a747
      
       ]
      
      Check the return value of i2c_add_adapter. Static analysis revealed that
      the function did not properly handle potential failures of
      i2c_add_adapter, which could lead to partial initialization of the I2C
      adapter and unstable operation.
      
      Signed-off-by: default avatarHaoran Liu <liuhaoran14@163.com>
      Link: https://lore.kernel.org/r/20231203164653.38983-1-liuhaoran14@163.com
      Fixes: d7535ffa
      
       ("Input: driver for microcontroller keys on the iPaq h3xxx")
      Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      66ccf5f7
    • Konrad Dybcio's avatar
      interconnect: qcom: sm8250: Enable sync_state · 3637f6bd
      Konrad Dybcio authored
      [ Upstream commit bfc7db1c ]
      
      Add the generic icc sync_state callback to ensure interconnect votes
      are taken into account, instead of being pegged at maximum values.
      
      Fixes: b95b668e
      
       ("interconnect: qcom: icc-rpmh: Add BCMs to commit list in pre_aggregate")
      Signed-off-by: default avatarKonrad Dybcio <konrad.dybcio@linaro.org>
      Link: https://lore.kernel.org/r/20231130-topic-8250icc_syncstate-v1-1-7ce78ba6e04c@linaro.org
      
      
      Signed-off-by: default avatarGeorgi Djakov <djakov@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      3637f6bd
    • Su Hui's avatar
      iio: imu: inv_mpu6050: fix an error code problem in inv_mpu6050_read_raw · 90aa6272
      Su Hui authored
      [ Upstream commit c3df0e29 ]
      
      inv_mpu6050_sensor_show() can return -EINVAL or IIO_VAL_INT. Return the
      true value rather than only return IIO_VAL_INT.
      
      Fixes: d5098447
      
       ("iio: imu: mpu6050: add calibration offset support")
      Signed-off-by: default avatarSu Hui <suhui@nfschina.com>
      Link: https://lore.kernel.org/r/20231030020218.65728-1-suhui@nfschina.com
      
      
      Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      90aa6272
    • Mike Tipton's avatar
      interconnect: Treat xlate() returning NULL node as an error · 50d60bfc
      Mike Tipton authored
      [ Upstream commit ad2ab129 ]
      
      Currently, if provider->xlate() or provider->xlate_extended()
      "successfully" return a NULL node, then of_icc_get_from_provider() won't
      consider that an error and will successfully return the NULL node. This
      bypasses error handling in of_icc_get_by_index() and leads to NULL
      dereferences in path_find().
      
      This could be avoided by ensuring provider callbacks always return an
      error for NULL nodes, but it's better to explicitly protect against this
      in the common framework.
      
      Fixes: 87e3031b
      
       ("interconnect: Allow endpoints translation via DT")
      Signed-off-by: default avatarMike Tipton <quic_mdtipton@quicinc.com>
      Link: https://lore.kernel.org/r/20231025145829.11603-1-quic_mdtipton@quicinc.com
      
      
      Signed-off-by: default avatarGeorgi Djakov <djakov@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      50d60bfc
    • Ville Syrjälä's avatar
      drm/i915: Fix ADL+ tiled plane stride when the POT stride is smaller than the original · 900c1b3c
      Ville Syrjälä authored
      [ Upstream commit 324b70e9
      
       ]
      
      plane_view_scanout_stride() currently assumes that we had to pad the
      mapping stride with dummy pages in order to align it. But that is not
      the case if the original fb stride exceeds the aligned stride used
      to populate the remapped view, which is calculated from the user
      specified framebuffer width rather than the user specified framebuffer
      stride.
      
      Ignore the original fb stride in this case and just stick to the POT
      aligned stride. Getting this wrong will cause the plane to fetch the
      wrong data, and can lead to fault errors if the page tables at the
      bogus location aren't even populated.
      
      TODO: figure out if this is OK for CCS, or if we should instead increase
      the width of the view to cover the entire user specified fb stride
      instead...
      
      Cc: Imre Deak <imre.deak@intel.com>
      Cc: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
      Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20231204202443.31247-1-ville.syrjala@linux.intel.com
      
      
      Reviewed-by: default avatarImre Deak <imre.deak@intel.com>
      Reviewed-by: default avatarJuha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
      (cherry picked from commit 01a39f1c
      
      )
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      900c1b3c
    • Clint Taylor's avatar
      drm/i915/mtl: Add MTL for remapping CCS FBs · de4349bd
      Clint Taylor authored
      [ Upstream commit 0da6bfe8
      
       ]
      
      Add support for remapping CCS FBs on MTL to remove the restriction
      of the power-of-two sized stride and the 2MB surface offset alignment
      for these FBs.
      
      Signed-off-by: default avatarClint Taylor <clinton.a.taylor@intel.com>
      Signed-off-by: default avatarJuha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
      Reviewed-by: default avatarRadhakrishna Sripada <radhakrishna.sripada@intel.com>
      Signed-off-by: default avatarNirmoy Das <nirmoy.das@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20230505144005.23480-2-nirmoy.das@intel.com
      Stable-dep-of: 324b70e9
      
       ("drm/i915: Fix ADL+ tiled plane stride when the POT stride is smaller than the original")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      de4349bd
    • Ville Syrjälä's avatar
      drm/i915/dpt: Only do the POT stride remap when using DPT · 52c1a67d
      Ville Syrjälä authored
      [ Upstream commit ef5cb493
      
       ]
      
      If we want to test with DPT disabled on ADL the POT stride remap
      stuff needs to be disabled. Make it depend on actual DPT usage
      instead of just assuming it based on the modifier.
      
      Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20230320090522.9909-3-ville.syrjala@linux.intel.com
      
      
      Reviewed-by: default avatarJuha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
      Stable-dep-of: 324b70e9
      
       ("drm/i915: Fix ADL+ tiled plane stride when the POT stride is smaller than the original")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      52c1a67d
    • Ville Syrjälä's avatar
      drm/i915: Fix intel_atomic_setup_scalers() plane_state handling · 7afe8109
      Ville Syrjälä authored
      [ Upstream commit c3070f08
      
       ]
      
      Since the plane_state variable is declared outside the scaler_users
      loop in intel_atomic_setup_scalers(), and it's never reset back to
      NULL inside the loop we may end up calling intel_atomic_setup_scaler()
      with a non-NULL plane state for the pipe scaling case. That is bad
      because intel_atomic_setup_scaler() determines whether we are doing
      plane scaling or pipe scaling based on plane_state!=NULL. The end
      result is that we may miscalculate the scaler mode for pipe scaling.
      
      The hardware becomes somewhat upset if we end up in this situation
      when scanning out a planar format on a SDR plane. We end up
      programming the pipe scaler into planar mode as well, and the
      result is a screenfull of garbage.
      
      Fix the situation by making sure we pass the correct plane_state==NULL
      when calculating the scaler mode for pipe scaling.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20231207193441.20206-2-ville.syrjala@linux.intel.com
      
      
      Reviewed-by: default avatarJani Nikula <jani.nikula@intel.com>
      (cherry picked from commit e8114410
      
      )
      Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      7afe8109