Skip to content
  1. Dec 14, 2023
    • Matthias Reichl's avatar
      regmap: fix bogus error on regcache_sync success · d91fb1b7
      Matthias Reichl authored
      commit fea88064 upstream.
      
      Since commit 0ec77316 ("regmap: Ensure range selector registers
      are updated after cache sync") opening pcm512x based soundcards fail
      with EINVAL and dmesg shows sync cache and pm_runtime_get errors:
      
      [  228.794676] pcm512x 1-004c: Failed to sync cache: -22
      [  228.794740] pcm512x 1-004c: ASoC: error at snd_soc_pcm_component_pm_runtime_get on pcm512x.1-004c: -22
      
      This is caused by the cache check result leaking out into the
      regcache_sync return value.
      
      Fix this by making the check local-only, as the comment above the
      regcache_read call states a non-zero return value means there's
      nothing to do so the return value should not be altered.
      
      Fixes: 0ec77316
      
       ("regmap: Ensure range selector registers are updated after cache sync")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarMatthias Reichl <hias@horus.com>
      Link: https://lore.kernel.org/r/20231203222216.96547-1-hias@horus.com
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d91fb1b7
    • Daniel Borkmann's avatar
      packet: Move reference count in packet_sock to atomic_long_t · d08a96e5
      Daniel Borkmann authored
      commit db3fadac
      
       upstream.
      
      In some potential instances the reference count on struct packet_sock
      could be saturated and cause overflows which gets the kernel a bit
      confused. To prevent this, move to a 64-bit atomic reference count on
      64-bit architectures to prevent the possibility of this type to overflow.
      
      Because we can not handle saturation, using refcount_t is not possible
      in this place. Maybe someday in the future if it changes it could be
      used. Also, instead of using plain atomic64_t, use atomic_long_t instead.
      32-bit machines tend to be memory-limited (i.e. anything that increases
      a reference uses so much memory that you can't actually get to 2**32
      references). 32-bit architectures also tend to have serious problems
      with 64-bit atomics. Hence, atomic_long_t is the more natural solution.
      
      Reported-by: default avatar"The UK's National Cyber Security Centre (NCSC)" <security@ncsc.gov.uk>
      Co-developed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: stable@kernel.org
      Reviewed-by: default avatarWillem de Bruijn <willemb@google.com>
      Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
      Link: https://lore.kernel.org/r/20231201131021.19999-1-daniel@iogearbox.net
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d08a96e5
    • Petr Pavlu's avatar
      tracing: Fix a possible race when disabling buffered events · c86b7689
      Petr Pavlu authored
      commit c0591b1c upstream.
      
      Function trace_buffered_event_disable() is responsible for freeing pages
      backing buffered events and this process can run concurrently with
      trace_event_buffer_lock_reserve().
      
      The following race is currently possible:
      
      * Function trace_buffered_event_disable() is called on CPU 0. It
        increments trace_buffered_event_cnt on each CPU and waits via
        synchronize_rcu() for each user of trace_buffered_event to complete.
      
      * After synchronize_rcu() is finished, function
        trace_buffered_event_disable() has the exclusive access to
        trace_buffered_event. All counters trace_buffered_event_cnt are at 1
        and all pointers trace_buffered_event are still valid.
      
      * At this point, on a different CPU 1, the execution reaches
        trace_event_buffer_lock_reserve(). The function calls
        preempt_disable_notrace() and only now enters an RCU read-side
        critical section. The function proceeds and reads a still valid
        pointer from trace_buffered_event[CPU1] into the local variable
        "entry". However, it doesn't yet read trace_buffered_event_cnt[CPU1]
        which happens later.
      
      * Function trace_buffered_event_disable() continues. It frees
        trace_buffered_event[CPU1] and decrements
        trace_buffered_event_cnt[CPU1] back to 0.
      
      * Function trace_event_buffer_lock_reserve() continues. It reads and
        increments trace_buffered_event_cnt[CPU1] from 0 to 1. This makes it
        believe that it can use the "entry" that it already obtained but the
        pointer is now invalid and any access results in a use-after-free.
      
      Fix the problem by making a second synchronize_rcu() call after all
      trace_buffered_event values are set to NULL. This waits on all potential
      users in trace_event_buffer_lock_reserve() that still read a previous
      pointer from trace_buffered_event.
      
      Link: https://lore.kernel.org/all/20231127151248.7232-2-petr.pavlu@suse.com/
      Link: https://lkml.kernel.org/r/20231205161736.19663-4-petr.pavlu@suse.com
      
      Cc: stable@vger.kernel.org
      Fixes: 0fc1b09f
      
       ("tracing: Use temp buffer when filtering events")
      Signed-off-by: default avatarPetr Pavlu <petr.pavlu@suse.com>
      Signed-off-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c86b7689
    • Petr Pavlu's avatar
      tracing: Fix incomplete locking when disabling buffered events · e733a6f8
      Petr Pavlu authored
      commit 7fed14f7 upstream.
      
      The following warning appears when using buffered events:
      
      [  203.556451] WARNING: CPU: 53 PID: 10220 at kernel/trace/ring_buffer.c:3912 ring_buffer_discard_commit+0x2eb/0x420
      [...]
      [  203.670690] CPU: 53 PID: 10220 Comm: stress-ng-sysin Tainted: G            E      6.7.0-rc2-default #4 56e6d0fcf5581e6e51eaaecbdaec2a2338c80f3a
      [  203.670704] Hardware name: Intel Corp. GROVEPORT/GROVEPORT, BIOS GVPRCRB1.86B.0016.D04.1705030402 05/03/2017
      [  203.670709] RIP: 0010:ring_buffer_discard_commit+0x2eb/0x420
      [  203.735721] Code: 4c 8b 4a 50 48 8b 42 48 49 39 c1 0f 84 b3 00 00 00 49 83 e8 01 75 b1 48 8b 42 10 f0 ff 40 08 0f 0b e9 fc fe ff ff f0 ff 47 08 <0f> 0b e9 77 fd ff ff 48 8b 42 10 f0 ff 40 08 0f 0b e9 f5 fe ff ff
      [  203.735734] RSP: 0018:ffffb4ae4f7b7d80 EFLAGS: 00010202
      [  203.735745] RAX: 0000000000000000 RBX: ffffb4ae4f7b7de0 RCX: ffff8ac10662c000
      [  203.735754] RDX: ffff8ac0c750be00 RSI: ffff8ac10662c000 RDI: ffff8ac0c004d400
      [  203.781832] RBP: ffff8ac0c039cea0 R08: 0000000000000000 R09: 0000000000000000
      [  203.781839] R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000
      [  203.781842] R13: ffff8ac10662c000 R14: ffff8ac0c004d400 R15: ffff8ac10662c008
      [  203.781846] FS:  00007f4cd8a67740(0000) GS:ffff8ad798880000(0000) knlGS:0000000000000000
      [  203.781851] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [  203.781855] CR2: 0000559766a74028 CR3: 00000001804c4000 CR4: 00000000001506f0
      [  203.781862] Call Trace:
      [  203.781870]  <TASK>
      [  203.851949]  trace_event_buffer_commit+0x1ea/0x250
      [  203.851967]  trace_event_raw_event_sys_enter+0x83/0xe0
      [  203.851983]  syscall_trace_enter.isra.0+0x182/0x1a0
      [  203.851990]  do_syscall_64+0x3a/0xe0
      [  203.852075]  entry_SYSCALL_64_after_hwframe+0x6e/0x76
      [  203.852090] RIP: 0033:0x7f4cd870fa77
      [  203.982920] Code: 00 b8 ff ff ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 66 90 b8 89 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d e9 43 0e 00 f7 d8 64 89 01 48
      [  203.982932] RSP: 002b:00007fff99717dd8 EFLAGS: 00000246 ORIG_RAX: 0000000000000089
      [  203.982942] RAX: ffffffffffffffda RBX: 0000558ea1d7b6f0 RCX: 00007f4cd870fa77
      [  203.982948] RDX: 0000000000000000 RSI: 00007fff99717de0 RDI: 0000558ea1d7b6f0
      [  203.982957] RBP: 00007fff99717de0 R08: 00007fff997180e0 R09: 00007fff997180e0
      [  203.982962] R10: 00007fff997180e0 R11: 0000000000000246 R12: 00007fff99717f40
      [  204.049239] R13: 00007fff99718590 R14: 0000558e9f2127a8 R15: 00007fff997180b0
      [  204.049256]  </TASK>
      
      For instance, it can be triggered by running these two commands in
      parallel:
      
       $ while true; do
          echo hist:key=id.syscall:val=hitcount > \
            /sys/kernel/debug/tracing/events/raw_syscalls/sys_enter/trigger;
        done
       $ stress-ng --sysinfo $(nproc)
      
      The warning indicates that the current ring_buffer_per_cpu is not in the
      committing state. It happens because the active ring_buffer_event
      doesn't actually come from the ring_buffer_per_cpu but is allocated from
      trace_buffered_event.
      
      The bug is in function trace_buffered_event_disable() where the
      following normally happens:
      
      * The code invokes disable_trace_buffered_event() via
        smp_call_function_many() and follows it by synchronize_rcu(). This
        increments the per-CPU variable trace_buffered_event_cnt on each
        target CPU and grants trace_buffered_event_disable() the exclusive
        access to the per-CPU variable trace_buffered_event.
      
      * Maintenance is performed on trace_buffered_event, all per-CPU event
        buffers get freed.
      
      * The code invokes enable_trace_buffered_event() via
        smp_call_function_many(). This decrements trace_buffered_event_cnt and
        releases the access to trace_buffered_event.
      
      A problem is that smp_call_function_many() runs a given function on all
      target CPUs except on the current one. The following can then occur:
      
      * Task X executing trace_buffered_event_disable() runs on CPU 0.
      
      * The control reaches synchronize_rcu() and the task gets rescheduled on
        another CPU 1.
      
      * The RCU synchronization finishes. At this point,
        trace_buffered_event_disable() has the exclusive access to all
        trace_buffered_event variables except trace_buffered_event[CPU0]
        because trace_buffered_event_cnt[CPU0] is never incremented and if the
        buffer is currently unused, remains set to 0.
      
      * A different task Y is scheduled on CPU 0 and hits a trace event. The
        code in trace_event_buffer_lock_reserve() sees that
        trace_buffered_event_cnt[CPU0] is set to 0 and decides the use the
        buffer provided by trace_buffered_event[CPU0].
      
      * Task X continues its execution in trace_buffered_event_disable(). The
        code incorrectly frees the event buffer pointed by
        trace_buffered_event[CPU0] and resets the variable to NULL.
      
      * Task Y writes event data to the now freed buffer and later detects the
        created inconsistency.
      
      The issue is observable since commit dea49978 ("tracing: Fix warning
      in trace_buffered_event_disable()") which moved the call of
      trace_buffered_event_disable() in __ftrace_event_enable_disable()
      earlier, prior to invoking call->class->reg(.. TRACE_REG_UNREGISTER ..).
      The underlying problem in trace_buffered_event_disable() is however
      present since the original implementation in commit 0fc1b09f
      ("tracing: Use temp buffer when filtering events").
      
      Fix the problem by replacing the two smp_call_function_many() calls with
      on_each_cpu_mask() which invokes a given callback on all CPUs.
      
      Link: https://lore.kernel.org/all/20231127151248.7232-2-petr.pavlu@suse.com/
      Link: https://lkml.kernel.org/r/20231205161736.19663-2-petr.pavlu@suse.com
      
      Cc: stable@vger.kernel.org
      Fixes: 0fc1b09f ("tracing: Use temp buffer when filtering events")
      Fixes: dea49978
      
       ("tracing: Fix warning in trace_buffered_event_disable()")
      Signed-off-by: default avatarPetr Pavlu <petr.pavlu@suse.com>
      Signed-off-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e733a6f8
    • Steven Rostedt (Google)'s avatar
      tracing: Disable snapshot buffer when stopping instance tracers · fb0219bf
      Steven Rostedt (Google) authored
      commit b538bf7d upstream.
      
      It use to be that only the top level instance had a snapshot buffer (for
      latency tracers like wakeup and irqsoff). When stopping a tracer in an
      instance would not disable the snapshot buffer. This could have some
      unintended consequences if the irqsoff tracer is enabled.
      
      Consolidate the tracing_start/stop() with tracing_start/stop_tr() so that
      all instances behave the same. The tracing_start/stop() functions will
      just call their respective tracing_start/stop_tr() with the global_array
      passed in.
      
      Link: https://lkml.kernel.org/r/20231205220011.041220035@goodmis.org
      
      Cc: stable@vger.kernel.org
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Fixes: 6d9b3fa5
      
       ("tracing: Move tracing_max_latency into trace_array")
      Signed-off-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      fb0219bf
    • Steven Rostedt (Google)'s avatar
      tracing: Always update snapshot buffer size · 9e41d92e
      Steven Rostedt (Google) authored
      commit 7be76461 upstream.
      
      It use to be that only the top level instance had a snapshot buffer (for
      latency tracers like wakeup and irqsoff). The update of the ring buffer
      size would check if the instance was the top level and if so, it would
      also update the snapshot buffer as it needs to be the same as the main
      buffer.
      
      Now that lower level instances also has a snapshot buffer, they too need
      to update their snapshot buffer sizes when the main buffer is changed,
      otherwise the following can be triggered:
      
       # cd /sys/kernel/tracing
       # echo 1500 > buffer_size_kb
       # mkdir instances/foo
       # echo irqsoff > instances/foo/current_tracer
       # echo 1000 > instances/foo/buffer_size_kb
      
      Produces:
      
       WARNING: CPU: 2 PID: 856 at kernel/trace/trace.c:1938 update_max_tr_single.part.0+0x27d/0x320
      
      Which is:
      
      	ret = ring_buffer_swap_cpu(tr->max_buffer.buffer, tr->array_buffer.buffer, cpu);
      
      	if (ret == -EBUSY) {
      		[..]
      	}
      
      	WARN_ON_ONCE(ret && ret != -EAGAIN && ret != -EBUSY);  <== here
      
      That's because ring_buffer_swap_cpu() has:
      
      	int ret = -EINVAL;
      
      	[..]
      
      	/* At least make sure the two buffers are somewhat the same */
      	if (cpu_buffer_a->nr_pages != cpu_buffer_b->nr_pages)
      		goto out;
      
      	[..]
       out:
      	return ret;
       }
      
      Instead, update all instances' snapshot buffer sizes when their main
      buffer size is updated.
      
      Link: https://lkml.kernel.org/r/20231205220010.454662151@goodmis.org
      
      Cc: stable@vger.kernel.org
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Fixes: 6d9b3fa5
      
       ("tracing: Move tracing_max_latency into trace_array")
      Signed-off-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9e41d92e
    • Heiko Carstens's avatar
      checkstack: fix printed address · ac3ccec3
      Heiko Carstens authored
      commit ee34db3f upstream.
      
      All addresses printed by checkstack have an extra incorrect 0 appended at
      the end.
      
      This was introduced with commit 677f1410 ("scripts/checkstack.pl: don't
      display $dre as different entity"): since then the address is taken from
      the line which contains the function name, instead of the line which
      contains stack consumption. E.g. on s390:
      
      0000000000100a30 <do_one_initcall>:
      ...
        100a44:       e3 f0 ff 70 ff 71       lay     %r15,-144(%r15)
      
      So the used regex which matches spaces and hexadecimal numbers to extract
      an address now matches a different substring. Subsequently replacing spaces
      with 0 appends a zero at the and, instead of replacing leading spaces.
      
      Fix this by using the proper regex, and simplify the code a bit.
      
      Link: https://lkml.kernel.org/r/20231120183719.2188479-2-hca@linux.ibm.com
      Fixes: 677f1410
      
       ("scripts/checkstack.pl: don't display $dre as different entity")
      Signed-off-by: default avatarHeiko Carstens <hca@linux.ibm.com>
      Cc: Maninder Singh <maninder1.s@samsung.com>
      Cc: Masahiro Yamada <masahiroy@kernel.org>
      Cc: Vaneet Narang <v.narang@samsung.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ac3ccec3
    • Ryusuke Konishi's avatar
      nilfs2: prevent WARNING in nilfs_sufile_set_segment_usage() · 762b0d52
      Ryusuke Konishi authored
      commit 675abf8d
      
       upstream.
      
      If nilfs2 reads a disk image with corrupted segment usage metadata, and
      its segment usage information is marked as an error for the segment at the
      write location, nilfs_sufile_set_segment_usage() can trigger WARN_ONs
      during log writing.
      
      Segments newly allocated for writing with nilfs_sufile_alloc() will not
      have this error flag set, but this unexpected situation will occur if the
      segment indexed by either nilfs->ns_segnum or nilfs->ns_nextnum (active
      segment) was marked in error.
      
      Fix this issue by inserting a sanity check to treat it as a file system
      corruption.
      
      Since error returns are not allowed during the execution phase where
      nilfs_sufile_set_segment_usage() is used, this inserts the sanity check
      into nilfs_sufile_mark_dirty() which pre-reads the buffer containing the
      segment usage record to be updated and sets it up in a dirty state for
      writing.
      
      In addition, nilfs_sufile_set_segment_usage() is also called when
      canceling log writing and undoing segment usage update, so in order to
      avoid issuing the same kernel warning in that case, in case of
      cancellation, avoid checking the error flag in
      nilfs_sufile_set_segment_usage().
      
      Link: https://lkml.kernel.org/r/20231205085947.4431-1-konishi.ryusuke@gmail.com
      Signed-off-by: default avatarRyusuke Konishi <konishi.ryusuke@gmail.com>
      Reported-by: default avatar <syzbot+14e9f834f6ddecece094@syzkaller.appspotmail.com>
      Closes: https://syzkaller.appspot.com/bug?extid=14e9f834f6ddecece094
      Tested-by: default avatarRyusuke Konishi <konishi.ryusuke@gmail.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      762b0d52
    • Ryusuke Konishi's avatar
      nilfs2: fix missing error check for sb_set_blocksize call · fd85766c
      Ryusuke Konishi authored
      commit d61d0ab5
      
       upstream.
      
      When mounting a filesystem image with a block size larger than the page
      size, nilfs2 repeatedly outputs long error messages with stack traces to
      the kernel log, such as the following:
      
       getblk(): invalid block size 8192 requested
       logical block size: 512
       ...
       Call Trace:
        dump_stack_lvl+0x92/0xd4
        dump_stack+0xd/0x10
        bdev_getblk+0x33a/0x354
        __breadahead+0x11/0x80
        nilfs_search_super_root+0xe2/0x704 [nilfs2]
        load_nilfs+0x72/0x504 [nilfs2]
        nilfs_mount+0x30f/0x518 [nilfs2]
        legacy_get_tree+0x1b/0x40
        vfs_get_tree+0x18/0xc4
        path_mount+0x786/0xa88
        __ia32_sys_mount+0x147/0x1a8
        __do_fast_syscall_32+0x56/0xc8
        do_fast_syscall_32+0x29/0x58
        do_SYSENTER_32+0x15/0x18
        entry_SYSENTER_32+0x98/0xf1
       ...
      
      This overloads the system logger.  And to make matters worse, it sometimes
      crashes the kernel with a memory access violation.
      
      This is because the return value of the sb_set_blocksize() call, which
      should be checked for errors, is not checked.
      
      The latter issue is due to out-of-buffer memory being accessed based on a
      large block size that caused sb_set_blocksize() to fail for buffers read
      with the initial minimum block size that remained unupdated in the
      super_block structure.
      
      Since nilfs2 mkfs tool does not accept block sizes larger than the system
      page size, this has been overlooked.  However, it is possible to create
      this situation by intentionally modifying the tool or by passing a
      filesystem image created on a system with a large page size to a system
      with a smaller page size and mounting it.
      
      Fix this issue by inserting the expected error handling for the call to
      sb_set_blocksize().
      
      Link: https://lkml.kernel.org/r/20231129141547.4726-1-konishi.ryusuke@gmail.com
      Signed-off-by: default avatarRyusuke Konishi <konishi.ryusuke@gmail.com>
      Tested-by: default avatarRyusuke Konishi <konishi.ryusuke@gmail.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      fd85766c
    • Bin Li's avatar
      ALSA: hda/realtek: Enable headset on Lenovo M90 Gen5 · 4bbf011b
      Bin Li authored
      commit 6f7e4664
      
       upstream.
      
      Lenovo M90 Gen5 is equipped with ALC897, and it needs
      ALC897_FIXUP_HEADSET_MIC_PIN quirk to make its headset mic work.
      
      Signed-off-by: default avatarBin Li <bin.li@canonical.com>
      Cc: <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/20231204100450.642783-1-bin.li@canonical.com
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4bbf011b
    • Jason Zhang's avatar
      ALSA: pcm: fix out-of-bounds in snd_pcm_state_names · e5571507
      Jason Zhang authored
      commit 2b3a7a30
      
       upstream.
      
      The pcm state can be SNDRV_PCM_STATE_DISCONNECTED at disconnect
      callback, and there is not an entry of SNDRV_PCM_STATE_DISCONNECTED
      in snd_pcm_state_names.
      
      This patch adds the missing entry to resolve this issue.
      
      cat /proc/asound/card2/pcm0p/sub0/status
      That results in stack traces like the following:
      
      [   99.702732][ T5171] Unexpected kernel BRK exception at EL1
      [   99.702774][ T5171] Internal error: BRK handler: f2005512 [#1] PREEMPT SMP
      [   99.703858][ T5171] Modules linked in: bcmdhd(E) (...)
      [   99.747425][ T5171] CPU: 3 PID: 5171 Comm: cat Tainted: G         C OE     5.10.189-android13-4-00003-g4a17384380d8-ab11086999 #1
      [   99.748447][ T5171] Hardware name: Rockchip RK3588 CVTE V10 Board (DT)
      [   99.749024][ T5171] pstate: 60400005 (nZCv daif +PAN -UAO -TCO BTYPE=--)
      [   99.749616][ T5171] pc : snd_pcm_substream_proc_status_read+0x264/0x2bc
      [   99.750204][ T5171] lr : snd_pcm_substream_proc_status_read+0xa4/0x2bc
      [   99.750778][ T5171] sp : ffffffc0175abae0
      [   99.751132][ T5171] x29: ffffffc0175abb80 x28: ffffffc009a2c498
      [   99.751665][ T5171] x27: 0000000000000001 x26: ffffff810cbae6e8
      [   99.752199][ T5171] x25: 0000000000400cc0 x24: ffffffc0175abc60
      [   99.752729][ T5171] x23: 0000000000000000 x22: ffffff802f558400
      [   99.753263][ T5171] x21: ffffff81d8d8ff00 x20: ffffff81020cdc00
      [   99.753795][ T5171] x19: ffffff802d110000 x18: ffffffc014fbd058
      [   99.754326][ T5171] x17: 0000000000000000 x16: 0000000000000000
      [   99.754861][ T5171] x15: 000000000000c276 x14: ffffffff9a976fda
      [   99.755392][ T5171] x13: 0000000065689089 x12: 000000000000d72e
      [   99.755923][ T5171] x11: ffffff802d110000 x10: 00000000000000e0
      [   99.756457][ T5171] x9 : 9c431600c8385d00 x8 : 0000000000000008
      [   99.756990][ T5171] x7 : 0000000000000000 x6 : 000000000000003f
      [   99.757522][ T5171] x5 : 0000000000000040 x4 : ffffffc0175abb70
      [   99.758056][ T5171] x3 : 0000000000000001 x2 : 0000000000000001
      [   99.758588][ T5171] x1 : 0000000000000000 x0 : 0000000000000000
      [   99.759123][ T5171] Call trace:
      [   99.759404][ T5171]  snd_pcm_substream_proc_status_read+0x264/0x2bc
      [   99.759958][ T5171]  snd_info_seq_show+0x54/0xa4
      [   99.760370][ T5171]  seq_read_iter+0x19c/0x7d4
      [   99.760770][ T5171]  seq_read+0xf0/0x128
      [   99.761117][ T5171]  proc_reg_read+0x100/0x1f8
      [   99.761515][ T5171]  vfs_read+0xf4/0x354
      [   99.761869][ T5171]  ksys_read+0x7c/0x148
      [   99.762226][ T5171]  __arm64_sys_read+0x20/0x30
      [   99.762625][ T5171]  el0_svc_common+0xd0/0x1e4
      [   99.763023][ T5171]  el0_svc+0x28/0x98
      [   99.763358][ T5171]  el0_sync_handler+0x8c/0xf0
      [   99.763759][ T5171]  el0_sync+0x1b8/0x1c0
      [   99.764118][ T5171] Code: d65f03c0 b9406102 17ffffae 94191565 (d42aa240)
      [   99.764715][ T5171] ---[ end trace 1eeffa3e17c58e10 ]---
      [   99.780720][ T5171] Kernel panic - not syncing: BRK handler: Fatal exception
      
      Signed-off-by: default avatarJason Zhang <jason.zhang@rock-chips.com>
      Cc: <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/20231206013139.20506-1-jason.zhang@rock-chips.com
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e5571507
    • Sarah Grant's avatar
      ALSA: usb-audio: Add Pioneer DJM-450 mixer controls · f82e39f7
      Sarah Grant authored
      commit bbb8e719
      
       upstream.
      
      These values mirror those of the Pioneer DJM-250MK2 as the channel layout
      appears identical based on my observations. This duplication could be removed in
      later contributions if desired.
      
      Signed-off-by: default avatarSarah Grant <s@srd.tw>
      Cc: <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/20231201181654.5058-1-s@srd.tw
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f82e39f7
    • Pavel Begunkov's avatar
      io_uring: fix mutex_unlock with unreferenced ctx · ea3291cb
      Pavel Begunkov authored
      commit f7b32e78 upstream.
      
      Callers of mutex_unlock() have to make sure that the mutex stays alive
      for the whole duration of the function call. For io_uring that means
      that the following pattern is not valid unless we ensure that the
      context outlives the mutex_unlock() call.
      
      mutex_lock(&ctx->uring_lock);
      req_put(req); // typically via io_req_task_submit()
      mutex_unlock(&ctx->uring_lock);
      
      Most contexts are fine: io-wq pins requests, syscalls hold the file,
      task works are taking ctx references and so on. However, the task work
      fallback path doesn't follow the rule.
      
      Cc:  <stable@vger.kernel.org>
      Fixes: 04fc6c80
      
       ("io_uring: save ctx put/get for task_work submit")
      Reported-by: default avatarJann Horn <jannh@google.com>
      Signed-off-by: default avatarPavel Begunkov <asml.silence@gmail.com>
      Link: https://lore.kernel.org/io-uring/CAG48ez3xSoYb+45f1RLtktROJrpiDQ1otNvdR+YLQf7m+Krj5Q@mail.gmail.com/
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ea3291cb
    • Georg Gottleuber's avatar
      nvme-pci: Add sleep quirk for Kingston drives · 09f9d1fb
      Georg Gottleuber authored
      commit 107b4e06
      
       upstream.
      
      Some Kingston NV1 and A2000 are wasting a lot of power on specific TUXEDO
      platforms in s2idle sleep if 'Simple Suspend' is used.
      
      This patch applies a new quirk 'Force No Simple Suspend' to achieve a
      low power sleep without 'Simple Suspend'.
      
      Signed-off-by: default avatarWerner Sembach <wse@tuxedocomputers.com>
      Signed-off-by: default avatarGeorg Gottleuber <ggo@tuxedocomputers.com>
      Cc: <stable@vger.kernel.org>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarKeith Busch <kbusch@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      09f9d1fb
    • JP Kobryn's avatar
      kprobes: consistent rcu api usage for kretprobe holder · 7e765ec2
      JP Kobryn authored
      commit d839a656 upstream.
      
      It seems that the pointer-to-kretprobe "rp" within the kretprobe_holder is
      RCU-managed, based on the (non-rethook) implementation of get_kretprobe().
      The thought behind this patch is to make use of the RCU API where possible
      when accessing this pointer so that the needed barriers are always in place
      and to self-document the code.
      
      The __rcu annotation to "rp" allows for sparse RCU checking. Plain writes
      done to the "rp" pointer are changed to make use of the RCU macro for
      assignment. For the single read, the implementation of get_kretprobe()
      is simplified by making use of an RCU macro which accomplishes the same,
      but note that the log warning text will be more generic.
      
      I did find that there is a difference in assembly generated between the
      usage of the RCU macros vs without. For example, on arm64, when using
      rcu_assign_pointer(), the corresponding store instruction is a
      store-release (STLR) which has an implicit barrier. When normal assignment
      is done, a regular store (STR) is found. In the macro case, this seems to
      be a result of rcu_assign_pointer() using smp_store_release() when the
      value to write is not NULL.
      
      Link: https://lore.kernel.org/all/20231122132058.3359-1-inwardvessel@gmail.com/
      
      Fixes: d741bf41
      
       ("kprobes: Remove kretprobe hash")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJP Kobryn <inwardvessel@gmail.com>
      Acked-by: default avatarMasami Hiramatsu (Google) <mhiramat@kernel.org>
      Signed-off-by: default avatarMasami Hiramatsu (Google) <mhiramat@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7e765ec2
    • Yu Kuai's avatar
      md: don't leave 'MD_RECOVERY_FROZEN' in error path of md_set_readonly() · f5311389
      Yu Kuai authored
      [ Upstream commit c9f7cb5b ]
      
      If md_set_readonly() failed, the array could still be read-write, however
      'MD_RECOVERY_FROZEN' could still be set, which leave the array in an
      abnormal state that sync or recovery can't continue anymore.
      Hence make sure the flag is cleared after md_set_readonly() returns.
      
      Fixes: 88724bfa
      
       ("md: wait for pending superblock updates before switching to read-only")
      Signed-off-by: default avatarYu Kuai <yukuai3@huawei.com>
      Acked-by: default avatarXiao Ni <xni@redhat.com>
      Signed-off-by: default avatarSong Liu <song@kernel.org>
      Link: https://lore.kernel.org/r/20231205094215.1824240-3-yukuai1@huaweicloud.com
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      f5311389
    • Ye Bin's avatar
      md: introduce md_ro_state · 4a52acc9
      Ye Bin authored
      [ Upstream commit f97a5528
      
       ]
      
      Introduce md_ro_state for mddev->ro, so it is easy to understand.
      
      Signed-off-by: default avatarYe Bin <yebin10@huawei.com>
      Signed-off-by: default avatarSong Liu <song@kernel.org>
      Stable-dep-of: c9f7cb5b
      
       ("md: don't leave 'MD_RECOVERY_FROZEN' in error path of md_set_readonly()")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      4a52acc9
    • Clément Léger's avatar
      riscv: fix misaligned access handling of C.SWSP and C.SDSP · 940a7bcd
      Clément Léger authored
      [ Upstream commit 22e0eb04 ]
      
      This is a backport of a fix that was done in OpenSBI: ec0559eb315b
      ("lib: sbi_misaligned_ldst: Fix handling of C.SWSP and C.SDSP").
      
      Unlike C.LWSP/C.LDSP, these encodings can be used with the zero
      register, so checking that the rs2 field is non-zero is unnecessary.
      
      Additionally, the previous check was incorrect since it was checking
      the immediate field of the instruction instead of the rs2 field.
      
      Fixes: 956d705d
      
       ("riscv: Unaligned load/store handling for M_MODE")
      Signed-off-by: default avatarClément Léger <cleger@rivosinc.com>
      Link: https://lore.kernel.org/r/20231103090223.702340-1-cleger@rivosinc.com
      Signed-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      940a7bcd
    • Fabio Estevam's avatar
      ARM: dts: imx28-xea: Pass the 'model' property · 6e2f7118
      Fabio Estevam authored
      [ Upstream commit 63ef8fc9
      
       ]
      
      Per root-node.yaml, 'model' is a required property.
      
      Pass it to fix the following dt-schema warning:
      
      imx28-xea.dtb: /: 'model' is a required property
      	from schema $id: http://devicetree.org/schemas/root-node.yaml#
      
      Signed-off-by: default avatarFabio Estevam <festevam@denx.de>
      Fixes: 445ae16a
      
       ("ARM: dts: imx28: Add DTS description of imx28 based XEA board")
      Signed-off-by: default avatarShawn Guo <shawnguo@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      6e2f7118
    • Philipp Zabel's avatar
      ARM: dts: imx7: Declare timers compatible with fsl,imx6dl-gpt · 976eb173
      Philipp Zabel authored
      [ Upstream commit 397caf68 ]
      
      The timer nodes declare compatibility with "fsl,imx6sx-gpt", which
      itself is compatible with "fsl,imx6dl-gpt". Switch the fallback
      compatible from "fsl,imx6sx-gpt" to "fsl,imx6dl-gpt".
      
      Fixes: 94967345
      
       ("ARM: dts: add imx7d soc dtsi file")
      Signed-off-by: default avatarPhilipp Zabel <p.zabel@pengutronix.de>
      Signed-off-by: default avatarRoland Hieber <rhi@pengutronix.de>
      Signed-off-by: default avatarShawn Guo <shawnguo@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      976eb173
    • Kunwu Chan's avatar
      ARM: imx: Check return value of devm_kasprintf in imx_mmdc_perf_init · cb2034c0
      Kunwu Chan authored
      [ Upstream commit 1c2b1049
      
       ]
      
      devm_kasprintf() returns a pointer to dynamically allocated memory
      which can be NULL upon failure. Ensure the allocation was successful
      by checking the pointer validity.
      
      Release the id allocated in 'mmdc_pmu_init' when 'devm_kasprintf'
      return NULL
      
      Suggested-by: default avatarAhmad Fatoum <a.fatoum@pengutronix.de>
      Fixes: e76bdfd7
      
       ("ARM: imx: Added perf functionality to mmdc driver")
      Signed-off-by: default avatarKunwu Chan <chentao@kylinos.cn>
      Signed-off-by: default avatarShawn Guo <shawnguo@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      cb2034c0
    • Dinghao Liu's avatar
      scsi: be2iscsi: Fix a memleak in beiscsi_init_wrb_handle() · 800aabe1
      Dinghao Liu authored
      [ Upstream commit 235f2b54 ]
      
      When an error occurs in the for loop of beiscsi_init_wrb_handle(), we
      should free phwi_ctxt->be_wrbq before returning an error code to prevent
      potential memleak.
      
      Fixes: a7909b39
      
       ("[SCSI] be2iscsi: Fix dynamic CID allocation Mechanism in driver")
      Signed-off-by: default avatarDinghao Liu <dinghao.liu@zju.edu.cn>
      Link: https://lore.kernel.org/r/20231123081941.24854-1-dinghao.liu@zju.edu.cn
      Reviewed-by: default avatarMike Christie <michael.christie@oracle.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      800aabe1
    • Petr Pavlu's avatar
      tracing: Fix a warning when allocating buffered events fails · 48987eef
      Petr Pavlu authored
      [ Upstream commit 34209fe8 ]
      
      Function trace_buffered_event_disable() produces an unexpected warning
      when the previous call to trace_buffered_event_enable() fails to
      allocate pages for buffered events.
      
      The situation can occur as follows:
      
      * The counter trace_buffered_event_ref is at 0.
      
      * The soft mode gets enabled for some event and
        trace_buffered_event_enable() is called. The function increments
        trace_buffered_event_ref to 1 and starts allocating event pages.
      
      * The allocation fails for some page and trace_buffered_event_disable()
        is called for cleanup.
      
      * Function trace_buffered_event_disable() decrements
        trace_buffered_event_ref back to 0, recognizes that it was the last
        use of buffered events and frees all allocated pages.
      
      * The control goes back to trace_buffered_event_enable() which returns.
        The caller of trace_buffered_event_enable() has no information that
        the function actually failed.
      
      * Some time later, the soft mode is disabled for the same event.
        Function trace_buffered_event_disable() is called. It warns on
        "WARN_ON_ONCE(!trace_buffered_event_ref)" and returns.
      
      Buffered events are just an optimization and can handle failures. Make
      trace_buffered_event_enable() exit on the first failure and left any
      cleanup later to when trace_buffered_event_disable() is called.
      
      Link: https://lore.kernel.org/all/20231127151248.7232-2-petr.pavlu@suse.com/
      Link: https://lkml.kernel.org/r/20231205161736.19663-3-petr.pavlu@suse.com
      
      Fixes: 0fc1b09f
      
       ("tracing: Use temp buffer when filtering events")
      Signed-off-by: default avatarPetr Pavlu <petr.pavlu@suse.com>
      Signed-off-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      48987eef
    • Fabio Estevam's avatar
      ARM: dts: imx6ul-pico: Describe the Ethernet PHY clock · 6daed371
      Fabio Estevam authored
      [ Upstream commit d951f8f5 ]
      
      Since commit c7e73b50 ("ARM: imx: mach-imx6ul: remove 14x14 EVK
      specific PHY fixup")thet Ethernet PHY is no longer configured via code
      in board file.
      
      This caused Ethernet to stop working.
      
      Fix this problem by describing the clocks and clock-names to the
      Ethernet PHY node so that the KSZ8081 chip can be clocked correctly.
      
      Fixes: c7e73b50
      
       ("ARM: imx: mach-imx6ul: remove 14x14 EVK specific PHY fixup")
      Signed-off-by: default avatarFabio Estevam <festevam@denx.de>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarShawn Guo <shawnguo@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      6daed371
    • Nathan Rossi's avatar
      arm64: dts: imx8mp: imx8mq: Add parkmode-disable-ss-quirk on DWC3 · 2ea7438a
      Nathan Rossi authored
      [ Upstream commit 209043cf ]
      
      The i.MX8MP and i.MX8MQ devices both use the same DWC3 controller and
      are both affected by a known issue with the controller due to specific
      behaviour when park mode is enabled in SuperSpeed host mode operation.
      
      Under heavy USB traffic from multiple endpoints the controller will
      sometimes incorrectly process transactions such that some transactions
      are lost, or the controller may hang when processing transactions. When
      the controller hangs it does not recover.
      
      This issue is documented partially within the linux-imx vendor kernel
      which references a Synopsys STAR number 9001415732 in commits [1] and
      additional details in [2]. Those commits provide some additional
      controller internal implementation specifics around the incorrect
      behaviour of the SuperSpeed host controller operation when park mode is
      enabled.
      
      The summary of this issue is that the host controller can incorrectly
      enter/exit park mode such that part of the controller is in a state
      which behaves as if in park mode even though it is not. In this state
      the controller incorrectly calculates the number of TRBs available which
      results in incorrect access of the internal caches causing the overwrite
      of pending requests in the cache which should have been processed but
      are ignored. This can cause the controller to drop the requests or hang
      waiting for the pending state of the dropped requests.
      
      The workaround for this issue is to disable park mode for SuperSpeed
      operation of the controller through the GUCTL1[17] bit. This is already
      available as a quirk for the DWC3 controller and can be enabled via the
      'snps,parkmode-disable-ss-quirk' device tree property.
      
      It is possible to replicate this failure on an i.MX8MP EVK with a USB
      Hub connecting 4 SuperSpeed USB flash drives. Performing continuous
      small read operations (dd if=/dev/sd... of=/dev/null bs=16) on the block
      devices will result in device errors initially and will eventually
      result in the controller hanging.
      
        [13240.896936] xhci-hcd xhci-hcd.0.auto: WARN Event TRB for slot 4 ep 2 with no TDs queued?
        [13240.990708] usb 2-1.3: reset SuperSpeed USB device number 5 using xhci-hcd
        [13241.015582] sd 2:0:0:0: [sdc] tag#0 UNKNOWN(0x2003) Result: hostbyte=0x07 driverbyte=DRIVER_OK cmd_age=0s
        [13241.025198] sd 2:0:0:0: [sdc] tag#0 CDB: opcode=0x28 28 00 00 00 03 e0 00 01 00 00
        [13241.032949] I/O error, dev sdc, sector 992 op 0x0:(READ) flags 0x80700 phys_seg 25 prio class 2
        [13272.150710] usb 2-1.2: reset SuperSpeed USB device number 4 using xhci-hcd
        [13272.175469] sd 1:0:0:0: [sdb] tag#0 UNKNOWN(0x2003) Result: hostbyte=0x03 driverbyte=DRIVER_OK cmd_age=31s
        [13272.185365] sd 1:0:0:0: [sdb] tag#0 CDB: opcode=0x28 28 00 00 00 03 e0 00 01 00 00
        [13272.193385] I/O error, dev sdb, sector 992 op 0x0:(READ) flags 0x80700 phys_seg 18 prio class 2
        [13434.846556] xhci-hcd xhci-hcd.0.auto: xHCI host not responding to stop endpoint command
        [13434.854592] xhci-hcd xhci-hcd.0.auto: xHCI host controller not responding, assume dead
        [13434.862553] xhci-hcd xhci-hcd.0.auto: HC died; cleaning up
      
      [1] https://github.com/nxp-imx/linux-imx/commit/97a5349d936b08cf301730b59e4e8855283f815c
      [2] https://github.com/nxp-imx/linux-imx/commit/b4b5cbc5a12d7c3b920d1d7cba0ada3379e4e42b
      
      Fixes: fb8587a2 ("arm64: dtsi: imx8mp: add usb nodes")
      Fixes: ad37549c
      
       ("arm64: dts: imx8mq: add USB nodes")
      Signed-off-by: default avatarNathan Rossi <nathan.rossi@digi.com>
      Reviewed-by: default avatarFabio Estevam <festevam@gmail.com>
      Signed-off-by: default avatarShawn Guo <shawnguo@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      2ea7438a
    • Peng Fan's avatar
      arm64: dts: imx8mq: drop usb3-resume-missing-cas from usb · 8a21980d
      Peng Fan authored
      [ Upstream commit fcd3f508
      
       ]
      
      The property is NXP downstream property that there is no user
      in upstream, drop it.
      
      Signed-off-by: default avatarPeng Fan <peng.fan@nxp.com>
      Link: https://lore.kernel.org/r/20230323035531.3808192-2-peng.fan@oss.nxp.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Stable-dep-of: 209043cf
      
       ("arm64: dts: imx8mp: imx8mq: Add parkmode-disable-ss-quirk on DWC3")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      8a21980d
    • Shifeng Li's avatar
      RDMA/irdma: Avoid free the non-cqp_request scratch · 0511a9c5
      Shifeng Li authored
      [ Upstream commit e3e82fcb ]
      
      When creating ceq_0 during probing irdma, cqp.sc_cqp will be sent as a
      cqp_request to cqp->sc_cqp.sq_ring. If the request is pending when
      removing the irdma driver or unplugging its aux device, cqp.sc_cqp will be
      dereferenced as wrong struct in irdma_free_pending_cqp_request().
      
        PID: 3669   TASK: ffff88aef892c000  CPU: 28  COMMAND: "kworker/28:0"
         #0 [fffffe0000549e38] crash_nmi_callback at ffffffff810e3a34
         #1 [fffffe0000549e40] nmi_handle at ffffffff810788b2
         #2 [fffffe0000549ea0] default_do_nmi at ffffffff8107938f
         #3 [fffffe0000549eb8] do_nmi at ffffffff81079582
         #4 [fffffe0000549ef0] end_repeat_nmi at ffffffff82e016b4
            [exception RIP: native_queued_spin_lock_slowpath+1291]
            RIP: ffffffff8127e72b  RSP: ffff88aa841ef778  RFLAGS: 00000046
            RAX: 0000000000000000  RBX: ffff88b01f849700  RCX: ffffffff8127e47e
            RDX: 0000000000000000  RSI: 0000000000000004  RDI: ffffffff83857ec0
            RBP: ffff88afe3e4efc8   R8: ffffed15fc7c9dfa   R9: ffffed15fc7c9dfa
            R10: 0000000000000001  R11: ffffed15fc7c9df9  R12: 0000000000740000
            R13: ffff88b01f849708  R14: 0000000000000003  R15: ffffed1603f092e1
            ORIG_RAX: ffffffffffffffff  CS: 0010  SS: 0000
        -- <NMI exception stack> --
         #5 [ffff88aa841ef778] native_queued_spin_lock_slowpath at ffffffff8127e72b
         #6 [ffff88aa841ef7b0] _raw_spin_lock_irqsave at ffffffff82c22aa4
         #7 [ffff88aa841ef7c8] __wake_up_common_lock at ffffffff81257363
         #8 [ffff88aa841ef888] irdma_free_pending_cqp_request at ffffffffa0ba12cc [irdma]
         #9 [ffff88aa841ef958] irdma_cleanup_pending_cqp_op at ffffffffa0ba1469 [irdma]
         #10 [ffff88aa841ef9c0] irdma_ctrl_deinit_hw at ffffffffa0b2989f [irdma]
         #11 [ffff88aa841efa28] irdma_remove at ffffffffa0b252df [irdma]
         #12 [ffff88aa841efae8] auxiliary_bus_remove at ffffffff8219afdb
         #13 [ffff88aa841efb00] device_release_driver_internal at ffffffff821882e6
         #14 [ffff88aa841efb38] bus_remove_device at ffffffff82184278
         #15 [ffff88aa841efb88] device_del at ffffffff82179d23
         #16 [ffff88aa841efc48] ice_unplug_aux_dev at ffffffffa0eb1c14 [ice]
         #17 [ffff88aa841efc68] ice_service_task at ffffffffa0d88201 [ice]
         #18 [ffff88aa841efde8] process_one_work at ffffffff811c589a
         #19 [ffff88aa841efe60] worker_thread at ffffffff811c71ff
         #20 [ffff88aa841eff10] kthread at ffffffff811d87a0
         #21 [ffff88aa841eff50] ret_from_fork at ffffffff82e0022f
      
      Fixes: 44d9e529
      
       ("RDMA/irdma: Implement device initialization definitions")
      Link: https://lore.kernel.org/r/20231130081415.891006-1-lishifeng@sangfor.com.cn
      Suggested-by: default avatar"Ismail, Mustafa" <mustafa.ismail@intel.com>
      Signed-off-by: default avatarShifeng Li <lishifeng@sangfor.com.cn>
      Reviewed-by: default avatarShiraz Saleem <shiraz.saleem@intel.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      0511a9c5
    • Mike Marciniszyn's avatar
      RDMA/core: Fix umem iterator when PAGE_SIZE is greater then HCA pgsz · b7b24a7f
      Mike Marciniszyn authored
      [ Upstream commit 4fbc3a52 ]
      
      64k pages introduce the situation in this diagram when the HCA 4k page
      size is being used:
      
       +-------------------------------------------+ <--- 64k aligned VA
       |                                           |
       |              HCA 4k page                  |
       |                                           |
       +-------------------------------------------+
       |                   o                       |
       |                                           |
       |                   o                       |
       |                                           |
       |                   o                       |
       +-------------------------------------------+
       |                                           |
       |              HCA 4k page                  |
       |                                           |
       +-------------------------------------------+ <--- Live HCA page
       |OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO| <--- offset
       |                                           | <--- VA
       |                MR data                    |
       +-------------------------------------------+
       |                                           |
       |              HCA 4k page                  |
       |                                           |
       +-------------------------------------------+
       |                   o                       |
       |                                           |
       |                   o                       |
       |                                           |
       |                   o                       |
       +-------------------------------------------+
       |                                           |
       |              HCA 4k page                  |
       |                                           |
       +-------------------------------------------+
      
      The VA addresses are coming from rdma-core in this diagram can be
      arbitrary, but for 64k pages, the VA may be offset by some number of HCA
      4k pages and followed by some number of HCA 4k pages.
      
      The current iterator doesn't account for either the preceding 4k pages or
      the following 4k pages.
      
      Fix the issue by extending the ib_block_iter to contain the number of DMA
      pages like comment [1] says and by using __sg_advance to start the
      iterator at the first live HCA page.
      
      The changes are contained in a parallel set of iterator start and next
      functions that are umem aware and specific to umem since there is one user
      of the rdma_for_each_block() without umem.
      
      These two fixes prevents the extra pages before and after the user MR
      data.
      
      Fix the preceding pages by using the __sq_advance field to start at the
      first 4k page containing MR data.
      
      Fix the following pages by saving the number of pgsz blocks in the
      iterator state and downcounting on each next.
      
      This fix allows for the elimination of the small page crutch noted in the
      Fixes.
      
      Fixes: 10c75ccb
      
       ("RDMA/umem: Prevent small pages from being returned by ib_umem_find_best_pgsz()")
      Link: https://lore.kernel.org/r/20231129202143.1434-2-shiraz.saleem@intel.com
      Signed-off-by: default avatarMike Marciniszyn <mike.marciniszyn@intel.com>
      Signed-off-by: default avatarShiraz Saleem <shiraz.saleem@intel.com>
      Reviewed-by: default avatarJason Gunthorpe <jgg@nvidia.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      b7b24a7f
    • Dinghao Liu's avatar
      ASoC: wm_adsp: fix memleak in wm_adsp_buffer_populate · 9d2854cc
      Dinghao Liu authored
      [ Upstream commit 29046a78 ]
      
      When wm_adsp_buffer_read() fails, we should free buf->regions.
      Otherwise, the callers of wm_adsp_buffer_populate() will
      directly free buf on failure, which makes buf->regions a leaked
      memory.
      
      Fixes: a792af69
      
       ("ASoC: wm_adsp: Refactor compress stream initialisation")
      Signed-off-by: default avatarDinghao Liu <dinghao.liu@zju.edu.cn>
      Reviewed-by: default avatarRichard Fitzgerald <rf@opensource.cirrus.com>
      Link: https://lore.kernel.org/r/20231204074158.12026-1-dinghao.liu@zju.edu.cn
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      9d2854cc
    • Christophe JAILLET's avatar
      hwmon: (nzxt-kraken2) Fix error handling path in kraken2_probe() · 1d31ea4d
      Christophe JAILLET authored
      [ Upstream commit 35fe2ad2 ]
      
      There is no point in calling hid_hw_stop() if hid_hw_start() has failed.
      There is no point in calling hid_hw_close() if hid_hw_open() has failed.
      
      Update the error handling path accordingly.
      
      Fixes: 82e3430d
      
       ("hwmon: add driver for NZXT Kraken X42/X52/X62/X72")
      Reported-by: default avatarAleksa Savic <savicaleksa83@gmail.com>
      Closes: https://lore.kernel.org/all/121470f0-6c1f-418a-844c-7ec2e8a54b8e@gmail.com/
      Signed-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
      Reviewed-by: default avatarJonas Malaco <jonas@protocubo.io>
      Link: https://lore.kernel.org/r/a768e69851a07a1f4e29f270f4e2559063f07343.1701617030.git.christophe.jaillet@wanadoo.fr
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      1d31ea4d
    • Armin Wolf's avatar
      hwmon: (acpi_power_meter) Fix 4.29 MW bug · 9deab0c3
      Armin Wolf authored
      [ Upstream commit 1fefca6c
      
       ]
      
      The ACPI specification says:
      
      "If an error occurs while obtaining the meter reading or if the value
      is not available then an Integer with all bits set is returned"
      
      Since the "integer" is 32 bits in case of the ACPI power meter,
      userspace will get a power reading of 2^32 * 1000 miliwatts (~4.29 MW)
      in case of such an error. This was discovered due to a lm_sensors
      bugreport (https://github.com/lm-sensors/lm-sensors/issues/460).
      Fix this by returning -ENODATA instead.
      
      Tested-by: default avatar <urbinek@gmail.com>
      Fixes: de584afa
      
       ("hwmon driver for ACPI 4.0 power meters")
      Signed-off-by: default avatarArmin Wolf <W_Armin@gmx.de>
      Link: https://lore.kernel.org/r/20231124182747.13956-1-W_Armin@gmx.de
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      9deab0c3
    • Kalesh AP's avatar
      RDMA/bnxt_re: Correct module description string · 8ef49679
      Kalesh AP authored
      [ Upstream commit 422b19f7 ]
      
      The word "Driver" is repeated twice in the "modinfo bnxt_re"
      output description. Fix it.
      
      Fixes: 1ac5a404
      
       ("RDMA/bnxt_re: Add bnxt_re RoCE driver")
      Signed-off-by: default avatarKalesh AP <kalesh-anakkur.purayil@broadcom.com>
      Signed-off-by: default avatarSelvin Xavier <selvin.xavier@broadcom.com>
      Link: https://lore.kernel.org/r/1700555387-6277-1-git-send-email-selvin.xavier@broadcom.com
      Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      8ef49679
    • Jack Wang's avatar
      RDMA/rtrs-clt: Remove the warnings for req in_use check · 0b21a39b
      Jack Wang authored
      [ Upstream commit 0c8bb6eb ]
      
      As we chain the WR during write request: memory registration,
      rdma write, local invalidate, if only the last WR fail to send due
      to send queue overrun, the server can send back the reply, while
      client mark the req->in_use to false in case of error in rtrs_clt_req
      when error out from rtrs_post_rdma_write_sg.
      
      Fixes: 6a98d71d
      
       ("RDMA/rtrs: client: main functionality")
      Signed-off-by: default avatarJack Wang <jinpu.wang@ionos.com>
      Reviewed-by: default avatarMd Haris Iqbal <haris.iqbal@ionos.com>
      Signed-off-by: default avatarGrzegorz Prajsner <grzegorz.prajsner@ionos.com>
      Link: https://lore.kernel.org/r/20231120154146.920486-8-haris.iqbal@ionos.com
      Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      0b21a39b
    • Jack Wang's avatar
      RDMA/rtrs-clt: Fix the max_send_wr setting · 6cef8ca1
      Jack Wang authored
      [ Upstream commit 6d09f6f7 ]
      
      For each write request, we need Request, Response Memory Registration,
      Local Invalidate.
      
      Fixes: 6a98d71d
      
       ("RDMA/rtrs: client: main functionality")
      Signed-off-by: default avatarJack Wang <jinpu.wang@ionos.com>
      Reviewed-by: default avatarMd Haris Iqbal <haris.iqbal@ionos.com>
      Signed-off-by: default avatarGrzegorz Prajsner <grzegorz.prajsner@ionos.com>
      Link: https://lore.kernel.org/r/20231120154146.920486-7-haris.iqbal@ionos.com
      Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      6cef8ca1
    • Md Haris Iqbal's avatar
      RDMA/rtrs-srv: Destroy path files after making sure no IOs in-flight · 855b4334
      Md Haris Iqbal authored
      [ Upstream commit c4d32e77 ]
      
      Destroying path files may lead to the freeing of rdma_stats. This creates
      the following race.
      
      An IO is in-flight, or has just passed the session state check in
      process_read/process_write. The close_work gets triggered and the function
      rtrs_srv_close_work() starts and does destroy path which frees the
      rdma_stats. After this the function process_read/process_write resumes and
      tries to update the stats through the function rtrs_srv_update_rdma_stats
      
      This commit solves the problem by moving the destroy path function to a
      later point. This point makes sure any inflights are completed. This is
      done by qp drain, and waiting for all in-flights through ops_id.
      
      Fixes: 9cb83748
      
       ("RDMA/rtrs: server: main functionality")
      Signed-off-by: default avatarMd Haris Iqbal <haris.iqbal@ionos.com>
      Signed-off-by: default avatarSantosh Kumar Pradhan <santosh.pradhan@ionos.com>
      Signed-off-by: default avatarGrzegorz Prajsner <grzegorz.prajsner@ionos.com>
      Link: https://lore.kernel.org/r/20231120154146.920486-6-haris.iqbal@ionos.com
      Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      855b4334
    • Md Haris Iqbal's avatar
      RDMA/rtrs-srv: Free srv_mr iu only when always_invalidate is true · 7df9d0d0
      Md Haris Iqbal authored
      [ Upstream commit 3a71cd6c ]
      
      Since srv_mr->iu is allocated and used only when always_invalidate is
      true, free it only when always_invalidate is true.
      
      Fixes: 9cb83748
      
       ("RDMA/rtrs: server: main functionality")
      Signed-off-by: default avatarMd Haris Iqbal <haris.iqbal@ionos.com>
      Signed-off-by: default avatarJack Wang <jinpu.wang@ionos.com>
      Signed-off-by: default avatarGrzegorz Prajsner <grzegorz.prajsner@ionos.com>
      Link: https://lore.kernel.org/r/20231120154146.920486-5-haris.iqbal@ionos.com
      Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      7df9d0d0
    • Md Haris Iqbal's avatar
      RDMA/rtrs-srv: Check return values while processing info request · 00e54da5
      Md Haris Iqbal authored
      [ Upstream commit ed1e52ae ]
      
      While processing info request, it could so happen that the srv_path goes
      to CLOSING state, cause of any of the error events from RDMA. That state
      change should be picked up while trying to change the state in
      process_info_req, by checking the return value. In case the state change
      call in process_info_req fails, we fail the processing.
      
      We should also check the return value for rtrs_srv_path_up, since it
      sends a link event to the client above, and the client can fail for any
      reason.
      
      Fixes: 9cb83748
      
       ("RDMA/rtrs: server: main functionality")
      Signed-off-by: default avatarMd Haris Iqbal <haris.iqbal@ionos.com>
      Signed-off-by: default avatarJack Wang <jinpu.wang@ionos.com>
      Signed-off-by: default avatarGrzegorz Prajsner <grzegorz.prajsner@ionos.com>
      Link: https://lore.kernel.org/r/20231120154146.920486-4-haris.iqbal@ionos.com
      Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      00e54da5
    • Jack Wang's avatar
      RDMA/rtrs-clt: Start hb after path_up · 59cab0ae
      Jack Wang authored
      [ Upstream commit 3e44a61b ]
      
      If we start hb too early, it will confuse server side to close
      the session.
      
      Fixes: 6a98d71d
      
       ("RDMA/rtrs: client: main functionality")
      Signed-off-by: default avatarJack Wang <jinpu.wang@ionos.com>
      Reviewed-by: default avatarMd Haris Iqbal <haris.iqbal@ionos.com>
      Signed-off-by: default avatarGrzegorz Prajsner <grzegorz.prajsner@ionos.com>
      Link: https://lore.kernel.org/r/20231120154146.920486-3-haris.iqbal@ionos.com
      Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      59cab0ae
    • Jack Wang's avatar
      RDMA/rtrs-srv: Do not unconditionally enable irq · 7f0460db
      Jack Wang authored
      [ Upstream commit 3ee7ecd7 ]
      
      When IO is completed, rtrs can be called in softirq context,
      unconditionally enabling irq could cause panic.
      
      To be on safe side, use spin_lock_irqsave and spin_unlock_irqrestore
      instread.
      
      Fixes: 9cb83748
      
       ("RDMA/rtrs: server: main functionality")
      Signed-off-by: default avatarJack Wang <jinpu.wang@ionos.com>
      Signed-off-by: default avatarFlorian-Ewald Mueller <florian-ewald.mueller@ionos.com>
      Signed-off-by: default avatarMd Haris Iqbal <haris.iqbal@ionos.com>
      Signed-off-by: default avatarGrzegorz Prajsner <grzegorz.prajsner@ionos.com>
      Link: https://lore.kernel.org/r/20231120154146.920486-2-haris.iqbal@ionos.com
      Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      7f0460db
    • Alex Bee's avatar
      arm64: dts: rockchip: Expand reg size of vdec node for RK3399 · 18556be8
      Alex Bee authored
      [ Upstream commit 35938c18 ]
      
      Expand the reg size for the vdec node to include cache/performance
      registers the rkvdec driver writes to. Also add missing clocks to the
      related power-domain.
      
      Fixes: cbd72144
      
       ("arm64: dts: rockchip: Define the rockchip Video Decoder node on rk3399")
      Signed-off-by: default avatarAlex Bee <knaerzche@gmail.com>
      Signed-off-by: default avatarJonas Karlman <jonas@kwiboo.se>
      Link: https://lore.kernel.org/r/20231105233630.3927502-10-jonas@kwiboo.se
      Signed-off-by: default avatarHeiko Stuebner <heiko@sntech.de>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      18556be8