Skip to content
  1. Jan 01, 2024
    • Mathieu Desnoyers's avatar
      ring-buffer: Fix 32-bit rb_time_read() race with rb_time_cmpxchg() · 82aaf7fc
      Mathieu Desnoyers authored
      [ Upstream commit dec89008 ]
      
      The following race can cause rb_time_read() to observe a corrupted time
      stamp:
      
      rb_time_cmpxchg()
      [...]
              if (!rb_time_read_cmpxchg(&t->msb, msb, msb2))
                      return false;
              if (!rb_time_read_cmpxchg(&t->top, top, top2))
                      return false;
      <interrupted before updating bottom>
      __rb_time_read()
      [...]
              do {
                      c = local_read(&t->cnt);
                      top = local_read(&t->top);
                      bottom = local_read(&t->bottom);
                      msb = local_read(&t->msb);
              } while (c != local_read(&t->cnt));
      
              *cnt = rb_time_cnt(top);
      
              /* If top and msb counts don't match, this interrupted a write */
              if (*cnt != rb_time_cnt(msb))
                      return false;
                ^ this check fails to catch that "bottom" is still not updated.
      
      So the old "bottom" value is returned, which is wrong.
      
      Fix this by checking that all three of msb, top, and bottom 2-bit cnt
      values match.
      
      The reason to favor checking all three fields over requiring a specific
      update order for both rb_time_set() and rb_time_cmpxchg() is because
      checking all three fields is more robust to handle partial failures of
      rb_time_cmpxchg() when interrupted by nested rb_time_set().
      
      Link: https://lore.kernel.org/lkml/20231211201324.652870-1-mathieu.desnoyers@efficios.com/
      Link: https://lore.kernel.org/linux-trace-kernel/20231212193049.680122-1-mathieu.desnoyers@efficios.com
      
      Fixes: f458a145
      
       ("ring-buffer: Test last update in 32bit version of __rb_time_read()")
      Signed-off-by: default avatarMathieu Desnoyers <mathieu.desnoyers@efficios.com>
      Signed-off-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      82aaf7fc
    • JP Kobryn's avatar
      9p: prevent read overrun in protocol dump tracepoint · 05908742
      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>
      05908742
    • Ville Syrjälä's avatar
      drm/i915/dmc: Don't enable any pipe DMC events · e0730d7e
      Ville Syrjälä authored
      commit 49e0a85e
      
       upstream.
      
      The pipe DMC seems to be making a mess of things in ADL. Various weird
      symptoms have been observed such as missing vblank irqs, typicalle
      happening when using multiple displays.
      
      Keep all pipe DMC event handlers disabled until needed (which is never
      atm). This is also what Windows does on ADL+.
      
      We can also drop DG2 from disable_all_flip_queue_events() since
      on DG2 the pipe DMC is the one that handles the flip queue events.
      
      Cc: stable@vger.kernel.org
      Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/8685
      Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20231211213750.27109-2-ville.syrjala@linux.intel.com
      Reviewed-by: default avatarImre Deak <imre.deak@intel.com>
      (cherry picked from commit 648d7be8
      
      )
      Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e0730d7e
    • Ville Syrjälä's avatar
      drm/i915: Reject async flips with bigjoiner · 706b554a
      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>
      706b554a
    • Paulo Alcantara's avatar
      smb: client: fix OOB in smbCalcSize() · ac48fcef
      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>
      ac48fcef
    • Paulo Alcantara's avatar
      smb: client: fix OOB in SMB2_query_info_init() · 3b5f0d0a
      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>
      3b5f0d0a
    • Paulo Alcantara's avatar
      smb: client: fix potential OOB in cifs_dump_detail() · 6630441c
      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>
      6630441c
    • Paulo Alcantara's avatar
      smb: client: fix OOB in cifsd when receiving compounded resps · c0e98de9
      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>
      c0e98de9
    • NeilBrown's avatar
      nfsd: call nfsd_last_thread() before final nfsd_put() · c21acd67
      NeilBrown authored
      commit 2a501f55 upstream.
      
      If write_ports_addfd or write_ports_addxprt fail, they call nfsd_put()
      without calling nfsd_last_thread().  This leaves nn->nfsd_serv pointing
      to a structure that has been freed.
      
      So remove 'static' from nfsd_last_thread() and call it when the
      nfsd_serv is about to be destroyed.
      
      Fixes: ec52361d
      
       ("SUNRPC: stop using ->sv_nrthreads as a refcount")
      Signed-off-by: default avatarNeilBrown <neilb@suse.de>
      Reviewed-by: default avatarJeff Layton <jlayton@kernel.org>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c21acd67
    • Fabio Estevam's avatar
      dt-bindings: nvmem: mxs-ocotp: Document fsl,ocotp · 7b5ef500
      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>
      7b5ef500
    • Lai Peter Jun Ann's avatar
      net: stmmac: fix incorrect flag check in timestamp interrupt · 93f763c2
      Lai Peter Jun Ann authored
      commit bd7f77da upstream.
      
      The driver should continue get the timestamp if STMMAC_FLAG_EXT_SNAPSHOT_EN
      flag is set.
      
      Fixes: aa5513f5
      
       ("net: stmmac: replace the ext_snapshot_en field with a flag")
      Cc: <stable@vger.kernel.org> # 6.6
      Signed-off-by: default avatarSong Yoong Siang <yoong.siang.song@intel.com>
      Signed-off-by: default avatarLai Peter Jun Ann <jun.ann.lai@intel.com>
      Reviewed-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Reviewed-by: default avatarSerge Semin <fancer.lancer@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      93f763c2
    • Thomas Weißschuh's avatar
      net: avoid build bug in skb extension length calculation · 92b8881b
      Thomas Weißschuh authored
      commit d6e5794b
      
       upstream.
      
      GCC seems to incorrectly fail to evaluate skb_ext_total_length() at
      compile time under certain conditions.
      
      The issue even occurs if all values in skb_ext_type_len[] are "0",
      ruling out the possibility of an actual overflow.
      
      As the patch has been in mainline since v6.6 without triggering the
      problem it seems to be a very uncommon occurrence.
      
      As the issue only occurs when -fno-tree-loop-im is specified as part of
      CFLAGS_GCOV, disable the BUILD_BUG_ON() only when building with coverage
      reporting enabled.
      
      Reported-by: default avatarkernel test robot <lkp@intel.com>
      Closes: https://lore.kernel.org/oe-kbuild-all/202312171924.4FozI5FG-lkp@intel.com/
      Suggested-by: default avatarArnd Bergmann <arnd@arndb.de>
      Link: https://lore.kernel.org/lkml/487cfd35-fe68-416f-9bfd-6bb417f98304@app.fastmail.com/
      Fixes: 5d21d0a6
      
       ("net: generalize calculation of skb extensions length")
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarThomas Weißschuh <linux@weissschuh.net>
      Acked-by: default avatarArnd Bergmann <arnd@arndb.de>
      Link: https://lore.kernel.org/r/20231218-net-skbuff-build-bug-v1-1-eefc2fb0a7d3@weissschuh.net
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      92b8881b
    • Ronald Wahl's avatar
      net: ks8851: Fix TX stall caused by TX buffer overrun · 30302b41
      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>
      30302b41
    • Rouven Czerwinski's avatar
      net: rfkill: gpio: set GPIO direction · d2821864
      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>
      d2821864
    • Fedor Pchelkin's avatar
      net: 9p: avoid freeing uninit memory in p9pdu_vreadf · 506ef81c
      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>
      506ef81c
    • Christoffer Sandberg's avatar
      Input: soc_button_array - add mapping for airplane mode button · cac20035
      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>
      cac20035
    • Jose Ignacio Tornos Martinez's avatar
      net: usb: ax88179_178a: avoid failed operations when device is disconnected · d4ab5cfa
      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>
      d4ab5cfa
    • Dan Carpenter's avatar
      usb: fotg210-hcd: delete an incorrect bounds test · ebd7bc41
      Dan Carpenter authored
      commit 7fbcd195 upstream.
      
      Here "temp" is the number of characters that we have written and "size"
      is the size of the buffer.  The intent was clearly to say that if we have
      written to the end of the buffer then stop.
      
      However, for that to work the comparison should have been done on the
      original "size" value instead of the "size -= temp" value.  Not only
      will that not trigger when we want to, but there is a small chance that
      it will trigger incorrectly before we want it to and we break from the
      loop slightly earlier than intended.
      
      This code was recently changed from using snprintf() to scnprintf().  With
      snprintf() we likely would have continued looping and passed a negative
      size parameter to snprintf().  This would have triggered an annoying
      WARN().  Now that we have converted to scnprintf() "size" will never
      drop below 1 and there is no real need for this test.  We could change
      the condition to "if (temp <= 1) goto done;" but just deleting the test
      is cleanest.
      
      Fixes: 7d50195f
      
       ("usb: host: Faraday fotg210-hcd driver")
      Cc: stable <stable@kernel.org>
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@linaro.org>
      Reviewed-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Reviewed-by: default avatarLee Jones <lee@kernel.org>
      Link: https://lore.kernel.org/r/ZXmwIwHe35wGfgzu@suswa
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ebd7bc41
    • Johan Hovold's avatar
      usb: typec: ucsi: fix gpio-based orientation detection · 847f8f52
      Johan Hovold authored
      commit c994cb59 upstream.
      
      Fix the recently added connector sanity check which was off by one and
      prevented orientation notifications from being handled correctly for the
      second port when using GPIOs to determine orientation.
      
      Fixes: c6165ed2
      
       ("usb: ucsi: glink: use the connector orientation GPIO to provide switch events")
      Cc: stable <stable@kernel.org>
      Cc: Neil Armstrong <neil.armstrong@linaro.org>
      Signed-off-by: default avatarJohan Hovold <johan+linaro@kernel.org>
      Reviewed-by: default avatarDmitry Baryshkov <dmitry.baryshkov@linaro.org>
      Reviewed-by: default avatarHeikki Krogerus <heikki.krogerus@linux.intel.com>
      Link: https://lore.kernel.org/r/20231208123603.29957-1-johan+linaro@kernel.org
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      847f8f52
    • Alex Lu's avatar
      Bluetooth: Add more enc key size check · 34c032a7
      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>
      34c032a7
    • Xiao Yao's avatar
      Bluetooth: MGMT/SMP: Fix address type when using SMP over BREDR/LE · 865f1f43
      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>
      865f1f43
    • Frédéric Danis's avatar
      Bluetooth: L2CAP: Send reject on command corrupted request · 0974347a
      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>
      0974347a
    • Hyunwoo Kim's avatar
      Bluetooth: af_bluetooth: Fix Use-After-Free in bt_sock_recvmsg · 1d576c3a
      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>
      1d576c3a
    • Luiz Augusto von Dentz's avatar
      Bluetooth: hci_event: Fix not checking if HCI_OP_INQUIRY has been sent · 90d6a397
      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>
      90d6a397
    • Gergo Koteles's avatar
      ASoC: tas2781: check the validity of prm_no/cfg_no · 9c756019
      Gergo Koteles authored
      commit f32c80d3 upstream.
      
      Add additional checks for program/config numbers to avoid loading from
      invalid addresses.
      
      If prm_no/cfg_no is negative, skip uploading program/config.
      
      The tas2781-hda driver caused a NULL pointer dereference after loading
      module, and before first runtime_suspend.
      
      the state was:
      tas_priv->cur_conf = -1;
      tas_priv->tasdevice[i].cur_conf = 0;
      program = &(tas_fmw->programs[-1]);
      
      BUG: kernel NULL pointer dereference, address: 0000000000000010
      Call Trace:
       <TASK>
       ? __die+0x23/0x70
       ? page_fault_oops+0x171/0x4e0
       ? vprintk_emit+0x175/0x2b0
       ? exc_page_fault+0x7f/0x180
       ? asm_exc_page_fault+0x26/0x30
       ? tasdevice_load_block_kernel+0x21/0x310 [snd_soc_tas2781_fmwlib]
       tasdevice_select_tuningprm_cfg+0x268/0x3a0 [snd_soc_tas2781_fmwlib]
       tasdevice_tuning_switch+0x69/0x710 [snd_soc_tas2781_fmwlib]
       tas2781_hda_playback_hook+0xd4/0x110 [snd_hda_scodec_tas2781_i2c]
      
      Fixes: 915f5ead
      
       ("ASoC: tas2781: firmware lib")
      CC:  <stable@vger.kernel.org>
      Signed-off-by: default avatarGergo Koteles <soyer@irl.hu>
      Link: https://msgid.link/r/523780155bfdca9bc0acd39efc79ed039454818d.1702591356.git.soyer@irl.hu
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9c756019
    • Clément Villeret's avatar
      ALSA: hda/realtek: Add quirk for ASUS ROG GV302XA · 23c2e6c0
      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>
      23c2e6c0
    • Gergo Koteles's avatar
      ALSA: hda/tas2781: select program 0, conf 0 by default · ff02d917
      Gergo Koteles authored
      commit ec1de5c2 upstream.
      
      Currently, cur_prog/cur_conf remains at the default value (-1), while
      program 0 has been loaded into the amplifiers.
      
      In the playback hook, tasdevice_tuning_switch tries to restore the
      cur_prog/cur_conf. In the runtime_resume/system_resume,
      tasdevice_prmg_load tries to load the cur_prog as well.
      
      Set cur_prog and cur_conf to 0 if available in the firmware.
      
      Fixes: 5be27f1e
      
       ("ALSA: hda/tas2781: Add tas2781 HDA driver")
      CC: stable@vger.kernel.org
      Signed-off-by: default avatarGergo Koteles <soyer@irl.hu>
      Link: https://lore.kernel.org/r/038add0bdca1f979cc7abcce8f24cbcd3544084b.1702596646.git.soyer@irl.hu
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ff02d917
    • Reinhard Speyerer's avatar
      USB: serial: option: add Quectel RM500Q R13 firmware support · 27149e82
      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>
      27149e82
    • Slark Xiao's avatar
      USB: serial: option: add Foxconn T99W265 with new baseline · 3cb3868e
      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>
      3cb3868e
    • Alper Ak's avatar
      USB: serial: option: add Quectel EG912Y module support · 7dbe89b7
      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>
      7dbe89b7
    • Mark Glover's avatar
      USB: serial: ftdi_sio: update Actisense PIDs constant names · 66c13151
      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>
      66c13151
    • Johannes Berg's avatar
      wifi: cfg80211: fix certs build to not depend on file order · 4ccca001
      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>
      4ccca001
    • Chen-Yu Tsai's avatar
      wifi: cfg80211: Add my certificate · 018f336f
      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>
      018f336f
    • Felix Fietkau's avatar
      wifi: mt76: fix crash with WED rx support enabled · e4006c5a
      Felix Fietkau authored
      commit cd607f2c upstream.
      
      If WED rx is enabled, rx buffers are added to a buffer pool that can be
      filled from multiple page pools. Because buffers freed from rx poll are
      not guaranteed to belong to the processed queue's page pool, lockless
      caching must not be used in this case.
      
      Cc: stable@vger.kernel.org
      Fixes: 2f5c3c77
      
       ("wifi: mt76: switch to page_pool allocator")
      Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
      Acked-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
      Signed-off-by: default avatarKalle Valo <kvalo@kernel.org>
      Link: https://lore.kernel.org/r/20231208075004.69843-1-nbd@nbd.name
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e4006c5a
    • Tasos Sahanidis's avatar
      usb-storage: Add quirk for incorrect WP on Kingston DT Ultimate 3.0 G3 · af60d63b
      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>
      af60d63b
    • Tony Lindgren's avatar
      ARM: dts: Fix occasional boot hang for am3 usb · 1937e408
      Tony Lindgren authored
      commit 9b6a51aa upstream.
      
      With subtle timings changes, we can now sometimes get an external abort on
      non-linefetch error booting am3 devices at sysc_reset(). This is because
      of a missing reset delay needed for the usb target module.
      
      Looks like we never enabled the delay earlier for am3, although a similar
      issue was seen earlier with a similar usb setup for dm814x as described in
      commit ebf24414 ("ARM: OMAP2+: Use srst_udelay for USB on dm814x").
      
      Cc: stable@vger.kernel.org
      Fixes: 0782e857
      
       ("ARM: dts: Probe am335x musb with ti-sysc")
      Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1937e408
    • Jeremie Knuesel's avatar
      ALSA: usb-audio: Increase delay in MOTU M quirk · e8e214d0
      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>
      e8e214d0
    • David Lechner's avatar
      iio: triggered-buffer: prevent possible freeing of wrong buffer · ae0faa92
      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>
      ae0faa92
    • Javier Carrasco's avatar
      iio: tmag5273: fix temperature offset · 55efc549
      Javier Carrasco authored
      commit 3b8157ec
      
       upstream.
      
      The current offset has the scale already applied to it. The ABI
      documentation defines the offset parameter as "offset to be added
      to <type>[Y]_raw prior to scaling by <type>[Y]_scale in order to
      obtain value in the <type> units as specified in <type>[Y]_raw
      documentation"
      
      The right value is obtained at 0 degrees Celsius by the formula provided
      in the datasheet:
      
      T = Tsens_t0 + (Tadc_t - Tadc_t0) / Tadc_res
      
      where:
      T = 0 degrees Celsius
      Tsens_t0 (reference temperature) = 25 degrees Celsius
      Tadc_t0 (16-bit format for Tsens_t0) = 17508
      Tadc_res = 60.1 LSB/degree Celsius
      
      The resulting offset is 16005.5, which has been truncated to 16005 to
      provide an integer value with a precision loss smaller than the 1-LSB
      measurement precision.
      
      Fix the offset to apply its value prior to scaling.
      
      Signed-off-by: default avatarJavier Carrasco <javier.carrasco@wolfvision.net>
      Link: https://lore.kernel.org/r/9879beec-05fc-4fc6-af62-d771e238954e@wolfvision.net
      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>
      55efc549
    • Wadim Egorov's avatar
      iio: adc: ti_am335x_adc: Fix return value check of tiadc_request_dma() · 7116fa37
      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>
      7116fa37