Skip to content

[REGRESSION][MTL] Kernel NULL pointer dereference in sof_ipc4_widget_setup after PR #5762 (fix for sof#10955) #5932

Closed

Description

@lscharf

References


Environment

  • Hardware: Lenovo ThinkPad X1 Carbon Gen 12 (21KC00FAFR)
  • CPU: Intel Core Ultra 7 155U (Meteor Lake-P)
  • Audio Device: Intel Meteor Lake-P HD Audio Controller (PCI 8086:7e28, SSID 17aa:231e)
  • Codec: Realtek ALC287 (sof-hda-dsp, machine driver snd_soc_skl_hda_dsp)
  • Firmware: ADSPFW version 2.14.1.1, topology intel/sof-ipc4-tplg/sof-hda-generic-2ch.tplg
  • Kernel: 7.2.3-arch1-3 (regression introduced in 7.2; working cleanly on 7.1.9-arch1-2)
  • Userspace: PipeWire 1.6.8 + WirePlumber 0.5.17

Description

PR #5762 added copier payload refresh logic to sof_ipc4_widget_setup() to prevent sending stale DMA channel assignments to firmware after suspend/resume cycles.

However, in sound/soc/sof/ipc4-topology.c, the new code assumes ipc4_copier->ipc_config_data is always non-NULL:

ipc_size = ipc4_copier->ipc_config_size;
ipc_data = ipc4_copier->ipc_config_data;

/* Refresh copier_data in ipc_config_data for host copiers */
if (swidget->id != snd_soc_dapm_buffer)
    memcpy(ipc_data, &ipc4_copier->data, sizeof(ipc4_copier->data));

On a cold stream setup / initial playback on Meteor Lake (sof-hda-generic-2ch.tplg), ipc4_copier->ipc_config_data can be NULL. This causes an unconditional memcpy(NULL, ...) that panics the kernel on stream startup.

Following the oops (exiting with interrupts disabled), subsequent ALSA operations hang in dpcm_fe_dai_close (uninterruptible D state), deadlocking WirePlumber and permanently disabling system audio until reboot.


Kernel Panic / Oops Log

BUG: kernel NULL pointer dereference, address: 0000000000000000
#PF: supervisor write access in kernel mode
#PF: error_code(0x0002) - not-present page
Oops: Oops: 0002 [#1] SMP NOPTI
CPU: 0 UID: 1000 PID: 25207 Comm: wireplumber Tainted: G           OE       7.2.3-arch1-3 #1 PREEMPT(full)
Hardware name: LENOVO 21KC00FAFR/21KC00FAFR, BIOS N3YET85W (1.50 ) 06/03/2026
RIP: 0010:sof_ipc4_widget_setup+0x1c2/0x5e0 [snd_sof]
Code: 48 8b 58 38 8b 73 4c 44 8b 63 58 4c 8b 7b 60 8d 0c b5 00 00 00 00 41 8d 44 24 b0 29 c8 89 c2 c1 ea 02 01 f2 89 53 4c 48 8b 13 <49> 89 17 48 8b 53 08 49 89 57 08 48 8b 53 10 49 89 57 10 48 8b 53
RSP: 0018:ffffd38ff659f3f0 EFLAGS: 00010202
RAX: 00000000ffffffac RBX: ffff8aae070f4000 RCX: 0000000000000004
RDX: 00000180000018f4 RSI: 0000000000000001 RDI: ffff8aae0aebd038
RBP: ffff8aadcad7b900 R08: 0000000000000000 R09: ffff8aae0b449900
R10: 0000000000000010 R11: 0000000000000000 R12: 0000000000000000
R13: 0000000000000000 R14: ffff8aae0aebd038 R15: 0000000000000000
FS:  00007fd30b04e840(0000) GS:ffff8ab17bb2e000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000000 CR3: 0000000148bc7002 CR4: 0000000000f72ef0
Call Trace:
 <TASK>
 ? sof_ipc4_set_generic_control_data.isra.0+0x101/0x140 [snd_sof]
 sof_widget_setup_unlocked+0xd2/0x490 [snd_sof]
 ? is_aggregated_dai+0x2f/0x50 [snd_sof]
 sof_set_up_widgets_in_path+0x176/0x210 [snd_sof]
 sof_set_up_widgets_in_path+0x11a/0x210 [snd_sof]
 sof_set_up_widgets_in_path+0x11a/0x210 [snd_sof]
 ? snd_pcm_common_ioctl+0x79/0x1570 [snd_pcm]
 entry_SYSCALL_64_after_hwframe+0x76/0x7e
 </TASK>
note: wireplumber[25207] exited with irqs disabled

Disassembly Analysis (snd-sof.ko)

1c641:  mov    0xd8(%rsi),%r15      # %r15 = ipc4_copier->ipc_config_data (0x0)
...
1c7af:  mov    (%rbx),%rdx
1c7b2:  mov    %rdx,(%r15)          # Fault: write to NULL (%r15) in inlined memcpy

Suggested Fix

Guard the memcpy() operations on ipc_data in sof_ipc4_widget_setup():

--- a/sound/soc/sof/ipc4-topology.c
+++ b/sound/soc/sof/ipc4-topology.c
@@ -3191,7 +3191,7 @@ static int sof_ipc4_widget_setup(struct snd_sof_dev *sdev, struct snd_sof_widget
 		 * ipc_prepare, e.g. when host stream tags change after a
 		 * suspend/resume cycle.
 		 */
-		if (swidget->id != snd_soc_dapm_buffer)
+		if (ipc_data && swidget->id != snd_soc_dapm_buffer)
 			memcpy(ipc_data, &ipc4_copier->data, sizeof(ipc4_copier->data));
 
 		msg = &ipc4_copier->msg;
@@ -3215,6 +3215,9 @@ static int sof_ipc4_widget_setup(struct snd_sof_dev *sdev, struct snd_sof_widget
 		ipc_size = ipc4_copier->ipc_config_size;
 		ipc_data = ipc4_copier->ipc_config_data;
 
+		if (!ipc_data)
+			break;
+
 		/*
 		 * Refresh copier_data and dma_config_tlv in ipc_config_data.
 		 * These may have been updated after ipc_prepare, e.g. when

Verification

  • Broken: Linux 7.2.3
  • Working: Linux 7.1.9 (downgrading restores full audio functionality on this ThinkPad).

Filed by Gemini via Oh My Pi.

Activity

  1. lscharf commented on Sep 9, 2026

    @lscharf
    Author

    Update: With WirePlumber 0.5.15, kernel 7.2.3 boots and plays audio completely normally without crashing.

    The initial NULL pointer dereference occurred because WirePlumber 0.5.17 suffered from an event loop deadlock (https://gitlab.freedesktop.org/pipewire/wireplumber/-/issues/1010) due to a missing transition:advance() on disabled IPU6 V4L2 devices, causing SPA proxies to be aborted and torn down mid-setup (Object activation aborted: proxy destroyed).

    While adding a defensive NULL check in sof_ipc4_widget_setup() may still be beneficial against aborted userland setups, the kernel 7.2.3 itself operates cleanly on Meteor Lake when userspace does not abort.

  2. lscharf commented on Sep 9, 2026

    @lscharf
    Author

    Closing as the root cause was identified to be WirePlumber 0.5.17's event loop deadlock (https://gitlab.freedesktop.org/pipewire/wireplumber/-/issues/1010). With WirePlumber 0.5.15, kernel 7.2.3 runs audio without issues on this platform.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions