<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-toradex.git/sound/synth, branch master</title>
<subtitle>Linux kernel for Apalis and Colibri modules</subtitle>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/'/>
<entry>
<title>ALSA: emux: Stop voices before freeing zones in all cases</title>
<updated>2026-10-20T10:58:39+00:00</updated>
<author>
<name>Takashi Iwai</name>
<email>tiwai@suse.de</email>
</author>
<published>2026-10-20T10:16:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=8a5d87c2ba30e8de31cfbe888fd4d95f43c63db9'/>
<id>8a5d87c2ba30e8de31cfbe888fd4d95f43c63db9</id>
<content type='text'>
The emux voice caches the soundfont zone pointer in vp-&gt;zone, which
is referred to later, e.g. in snd_emux_send_effect().  For avoiding
dangling pointers, the soundfont code calls the sample_reset callback
to stop all voices before freeing zones.  However, in a few cases
(e.g. emu10k1's missing sample_reset or the call path via
remove_info()), the sample reset isn't called properly, leaving the
playing voices.

Fix it by always registering the sample_reset callback, falling back
to snd_emux_terminate_all() when the driver has no own ops, and by
calling sample_reset in remove_info() before freeing the zones.

Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20261020101624.205638-2-tiwai@suse.de
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The emux voice caches the soundfont zone pointer in vp-&gt;zone, which
is referred to later, e.g. in snd_emux_send_effect().  For avoiding
dangling pointers, the soundfont code calls the sample_reset callback
to stop all voices before freeing zones.  However, in a few cases
(e.g. emu10k1's missing sample_reset or the call path via
remove_info()), the sample reset isn't called properly, leaving the
playing voices.

Fix it by always registering the sample_reset callback, falling back
to snd_emux_terminate_all() when the driver has no own ops, and by
calling sample_reset in remove_info() before freeing the zones.

Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20261020101624.205638-2-tiwai@suse.de
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>ALSA: emux: Fix UAF of soundfont zones at note-on</title>
<updated>2026-10-20T10:58:25+00:00</updated>
<author>
<name>Takashi Iwai</name>
<email>tiwai@suse.de</email>
</author>
<published>2026-10-20T10:16:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=34e3e04b8a1731a773797542f0781e99ce7cd755'/>
<id>34e3e04b8a1731a773797542f0781e99ce7cd755</id>
<content type='text'>
snd_emux_note_on() looks up the matching zones via
snd_soundfont_search_zone(), which takes sflist-&gt;lock only during the
lookup and returns the raw zone pointers after releasing it.  The
caller then stores them in vp-&gt;zone without any protection.
Meanwhile, a concurrent SNDRV_EMUX_IOCTL_REMOVE_LAST_SAMPLES ioctl may
unlink and free those zones in snd_soundfont_remove_unlocked(); this
leads to a use-after-free in snd_emux_note_on(), and later at
accessing the cached vp-&gt;zone, e.g. in snd_emux_send_effect().

Fix it by holding sflist-&gt;lock in snd_emux_note_on() over the whole
zone lookup and voice setup, and let snd_soundfont_search_zone()
require the caller to hold the lock, instead.
snd_soundfont_lock_preset() takes sflist-&gt;lock for setting
presets_locked, so the removal path now syncs with the note-on finish.

Reported-by: Sashiko &lt;sashiko-bot@kernel.org&gt;
Closes: https://sashiko.dev/#/bug/linux-697212bb-a434-4ff5-8778-25a84f5dad89
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20261020101624.205638-1-tiwai@suse.de
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
snd_emux_note_on() looks up the matching zones via
snd_soundfont_search_zone(), which takes sflist-&gt;lock only during the
lookup and returns the raw zone pointers after releasing it.  The
caller then stores them in vp-&gt;zone without any protection.
Meanwhile, a concurrent SNDRV_EMUX_IOCTL_REMOVE_LAST_SAMPLES ioctl may
unlink and free those zones in snd_soundfont_remove_unlocked(); this
leads to a use-after-free in snd_emux_note_on(), and later at
accessing the cached vp-&gt;zone, e.g. in snd_emux_send_effect().

Fix it by holding sflist-&gt;lock in snd_emux_note_on() over the whole
zone lookup and voice setup, and let snd_soundfont_search_zone()
require the caller to hold the lock, instead.
snd_soundfont_lock_preset() takes sflist-&gt;lock for setting
presets_locked, so the removal path now syncs with the note-on finish.

Reported-by: Sashiko &lt;sashiko-bot@kernel.org&gt;
Closes: https://sashiko.dev/#/bug/linux-697212bb-a434-4ff5-8778-25a84f5dad89
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20261020101624.205638-1-tiwai@suse.de
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>ALSA: emux: Guard the OSS argument during port initialization</title>
<updated>2026-10-14T06:15:53+00:00</updated>
<author>
<name>Cen Zhang</name>
<email>zzzccc427@gmail.com</email>
</author>
<published>2026-10-14T04:02:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=d6e4158d92936987d963040c8ae2657a328459b8'/>
<id>d6e4158d92936987d963040c8ae2657a328459b8</id>
<content type='text'>
The OSS argument must be non-NULL before reset_port_mode() writes its
event_passing field. snd_emux_open_seq_oss() assigns p-&gt;oss_arg only
after snd_emux_create_port() attaches the writable sequencer port, so
this field is still NULL when the callback first becomes reachable.

With sequencer OSS and an EMUX provider enabled, another sequencer
client can learn the new address from a PORT_START announcement and
send a direct SNDRV_SEQ_EVENT_OSS channel-mode command, with marker
0xfe and command byte 0x8a. The following ordering is possible:

  OSS opener                        Sequencer writer
  snd_emux_create_port()
    snd_seq_event_port_attach()
      publish port, announce
                                    receive PORT_START
                                    snd_seq_write()
                                      snd_emux_event_oss_input()
                                        reset_port_mode()
                                          write via NULL oss_arg
  p-&gt;oss_arg = arg

The callback's write precedes the opener's assignment. The core's port
reference keeps the private data allocated but does not wait for its
initialization. The write therefore dereferences NULL and can panic the
kernel, as shown by the report below.

Take a single READ_ONCE() snapshot of oss_arg and update event_passing
only when that snapshot is non-NULL. Pair it with WRITE_ONCE() in the
open path, so the check and write use the same pointer despite
concurrent initialization. The open path still sets the initial mode
after assigning the argument, and subsequent channel-mode events retain
their existing handling.

KASAN report as below:

    Oops: general protection fault, probably for non-canonical address 0xdffffc0000000003: 0000 [#1] SMP KASAN NOPTI
    KASAN: null-ptr-deref in range [0x0000000000000018-0x000000000000001f]
    CPU: 2 UID: 0 PID: 495 Comm: fixture Tainted: G           O        7.2.0-rc6-pmb-bt-functional-v1+ #1 PREEMPT(lazy)
    Tainted: [O]=OOT_MODULE
    Hardware name: QEMU Ubuntu 24.04 PC v2 (i440FX + PIIX, arch_caps fix, 1996), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
    RIP: 0010:snd_emux_event_oss_input+0xa76/0xdd0
    Code: fc ff df 48 c1 ea 03 80 3c 02 00 0f 85 e1 02 00 00 48 b8 00 00 00 00 00 fc ff df 48 8b 5d 78 48 8d 7b 18 48 89 fa 48 c1 ea 03 &lt;0f&gt; b6 04 02 84 c0 74 08 3c 03 0f 8e 40 03 00 00 c7 43 18 00 00 00
    RSP: 0018:ffff88810a937888 EFLAGS: 00010216
    RAX: dffffc0000000000 RBX: 0000000000000000 RCX: ffffffff84f391b2
    RDX: 0000000000000003 RSI: 0000000000000000 RDI: 0000000000000018
    RBP: ffff8881179fc000 R08: 0000000000000001 R09: 0000000000000001
    R10: ffffffff89444257 R11: ffff888107dd3a00 R12: 1ffff11021526f17
    R13: 0000000000000000 R14: 0000000000000001 R15: ffff888112cda000
    FS:  00007fdd13c9f780(0000) GS:ffff8881fd826000(0000) knlGS:0000000000000000
    CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 00007fdd13e2f943 CR3: 00000001057ba005 CR4: 0000000000770ef0
    PKRU: 55555554
    Call Trace:
     &lt;TASK&gt;
     ? __pfx_snd_emux_event_oss_input+0x10/0x10
     ? snd_seq_port_use_ptr+0x40/0x170
     ? srso_alias_return_thunk+0x5/0xfbef5
     ? find_held_lock+0x2b/0x80
     ? snd_seq_port_use_ptr+0x10c/0x170
     ? srso_alias_return_thunk+0x5/0xfbef5
     ? lock_release+0xc8/0x280
     ? srso_alias_return_thunk+0x5/0xfbef5
     ? __pfx_snd_emux_event_oss_input+0x10/0x10
     __snd_seq_deliver_single_event+0x105/0x1a0
     ? snd_seq_port_use_ptr+0x111/0x170
     snd_seq_deliver_single_event+0x2fc/0x770
     ? __pfx_snd_seq_deliver_single_event+0x10/0x10
     ? srso_alias_return_thunk+0x5/0xfbef5
     ? add_lock_to_list+0x9d/0x1e0
     ? srso_alias_return_thunk+0x5/0xfbef5
     ? check_prev_add+0x34c/0xe80
     snd_seq_deliver_event+0x45a/0x760
     ? __pfx_snd_seq_deliver_event+0x10/0x10
     ? srso_alias_return_thunk+0x5/0xfbef5
     ? srso_alias_return_thunk+0x5/0xfbef5
     ? lock_acquire+0x17b/0x2f0
     snd_seq_client_enqueue_event.constprop.0+0x278/0x430
     ? __pfx_snd_seq_client_enqueue_event.constprop.0+0x10/0x10
     ? __might_fault+0xdd/0x190
     ? srso_alias_return_thunk+0x5/0xfbef5
     ? __might_fault+0x14e/0x190
     ? _raw_spin_unlock_irq+0x28/0x50
     snd_seq_write+0x30a/0x5e0
     ? __pfx_snd_seq_write+0x10/0x10
     ? selinux_file_permission+0x122/0x570
     ? srso_alias_return_thunk+0x5/0xfbef5
     ? security_file_permission+0x26/0x80
     vfs_write+0x25a/0x1010
     ? __pfx_snd_seq_write+0x10/0x10
     ? __pfx_vfs_write+0x10/0x10
     ? srso_alias_return_thunk+0x5/0xfbef5
     ? trace_hardirqs_on+0x18/0x160
     ? srso_alias_return_thunk+0x5/0xfbef5
     ? __call_rcu_common.constprop.0+0x5c1/0xbd0
     ? srso_alias_return_thunk+0x5/0xfbef5
     ? __fput+0x5ba/0xa60
     ksys_write+0x1b7/0x200
     ? __pfx_ksys_write+0x10/0x10
     do_syscall_64+0x115/0x6a0
     entry_SYSCALL_64_after_hwframe+0x77/0x7f
    RIP: 0033:0x7fdd13d31687
    Code: 48 89 fa 4c 89 df e8 58 b3 00 00 8b 93 08 03 00 00 59 5e 48 83 f8 fc 74 1a 5b c3 0f 1f 84 00 00 00 00 00 48 8b 44 24 10 0f 05 &lt;5b&gt; c3 0f 1f 80 00 00 00 00 83 e2 39 83 fa 08 75 de e8 23 ff ff ff
    RSP: 002b:00007fff073e9f20 EFLAGS: 00000202 ORIG_RAX: 0000000000000001
    RAX: ffffffffffffffda RBX: 00007fdd13c9f780 RCX: 00007fdd13d31687
    RDX: 000000000000001c RSI: 00007fff073e9fc0 RDI: 0000000000000003
    RBP: 0000000000000003 R08: 0000000000000000 R09: 0000000000000000
    R10: 0000000000000000 R11: 0000000000000202 R12: 0000561260c48082
    R13: 0000561260c48011 R14: 0000561260c4809d R15: 0000000000000002
     &lt;/TASK&gt;
    Modules linked in: snd_emux_validation(O)
    ---[ end trace 0000000000000000 ]---
    RIP: 0010:snd_emux_event_oss_input+0xa76/0xdd0
    Code: fc ff df 48 c1 ea 03 80 3c 02 00 0f 85 e1 02 00 00 48 b8 00 00 00 00 00 fc ff df 48 8b 5d 78 48 8d 7b 18 48 89 fa 48 c1 ea 03 &lt;0f&gt; b6 04 02 84 c0 74 08 3c 03 0f 8e 40 03 00 00 c7 43 18 00 00 00
    RSP: 0018:ffff88810a937888 EFLAGS: 00010216
    RAX: dffffc0000000000 RBX: 0000000000000000 RCX: ffffffff84f391b2
    RDX: 0000000000000003 RSI: 0000000000000000 RDI: 0000000000000018
    RBP: ffff8881179fc000 R08: 0000000000000001 R09: 0000000000000001
    R10: ffffffff89444257 R11: ffff888107dd3a00 R12: 1ffff11021526f17
    R13: 0000000000000000 R14: 0000000000000001 R15: ffff888112cda000
    FS:  00007fdd13c9f780(0000) GS:ffff8881fd826000(0000) knlGS:0000000000000000
    CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 00007fdd13e2f943 CR3: 00000001057ba005 CR4: 0000000000770ef0
    PKRU: 55555554
    Kernel panic - not syncing: Fatal exception
    Kernel Offset: disabled
    Rebooting in 1 seconds..

Assisted-by: LLM
Signed-off-by: Cen Zhang &lt;zzzccc427@gmail.com&gt;
Link: https://patch.msgid.link/pm-pmb-f8d6ccb28f196910444f-v2-c253bf022b6e954a7bdc@gmail.com
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The OSS argument must be non-NULL before reset_port_mode() writes its
event_passing field. snd_emux_open_seq_oss() assigns p-&gt;oss_arg only
after snd_emux_create_port() attaches the writable sequencer port, so
this field is still NULL when the callback first becomes reachable.

With sequencer OSS and an EMUX provider enabled, another sequencer
client can learn the new address from a PORT_START announcement and
send a direct SNDRV_SEQ_EVENT_OSS channel-mode command, with marker
0xfe and command byte 0x8a. The following ordering is possible:

  OSS opener                        Sequencer writer
  snd_emux_create_port()
    snd_seq_event_port_attach()
      publish port, announce
                                    receive PORT_START
                                    snd_seq_write()
                                      snd_emux_event_oss_input()
                                        reset_port_mode()
                                          write via NULL oss_arg
  p-&gt;oss_arg = arg

The callback's write precedes the opener's assignment. The core's port
reference keeps the private data allocated but does not wait for its
initialization. The write therefore dereferences NULL and can panic the
kernel, as shown by the report below.

Take a single READ_ONCE() snapshot of oss_arg and update event_passing
only when that snapshot is non-NULL. Pair it with WRITE_ONCE() in the
open path, so the check and write use the same pointer despite
concurrent initialization. The open path still sets the initial mode
after assigning the argument, and subsequent channel-mode events retain
their existing handling.

KASAN report as below:

    Oops: general protection fault, probably for non-canonical address 0xdffffc0000000003: 0000 [#1] SMP KASAN NOPTI
    KASAN: null-ptr-deref in range [0x0000000000000018-0x000000000000001f]
    CPU: 2 UID: 0 PID: 495 Comm: fixture Tainted: G           O        7.2.0-rc6-pmb-bt-functional-v1+ #1 PREEMPT(lazy)
    Tainted: [O]=OOT_MODULE
    Hardware name: QEMU Ubuntu 24.04 PC v2 (i440FX + PIIX, arch_caps fix, 1996), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
    RIP: 0010:snd_emux_event_oss_input+0xa76/0xdd0
    Code: fc ff df 48 c1 ea 03 80 3c 02 00 0f 85 e1 02 00 00 48 b8 00 00 00 00 00 fc ff df 48 8b 5d 78 48 8d 7b 18 48 89 fa 48 c1 ea 03 &lt;0f&gt; b6 04 02 84 c0 74 08 3c 03 0f 8e 40 03 00 00 c7 43 18 00 00 00
    RSP: 0018:ffff88810a937888 EFLAGS: 00010216
    RAX: dffffc0000000000 RBX: 0000000000000000 RCX: ffffffff84f391b2
    RDX: 0000000000000003 RSI: 0000000000000000 RDI: 0000000000000018
    RBP: ffff8881179fc000 R08: 0000000000000001 R09: 0000000000000001
    R10: ffffffff89444257 R11: ffff888107dd3a00 R12: 1ffff11021526f17
    R13: 0000000000000000 R14: 0000000000000001 R15: ffff888112cda000
    FS:  00007fdd13c9f780(0000) GS:ffff8881fd826000(0000) knlGS:0000000000000000
    CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 00007fdd13e2f943 CR3: 00000001057ba005 CR4: 0000000000770ef0
    PKRU: 55555554
    Call Trace:
     &lt;TASK&gt;
     ? __pfx_snd_emux_event_oss_input+0x10/0x10
     ? snd_seq_port_use_ptr+0x40/0x170
     ? srso_alias_return_thunk+0x5/0xfbef5
     ? find_held_lock+0x2b/0x80
     ? snd_seq_port_use_ptr+0x10c/0x170
     ? srso_alias_return_thunk+0x5/0xfbef5
     ? lock_release+0xc8/0x280
     ? srso_alias_return_thunk+0x5/0xfbef5
     ? __pfx_snd_emux_event_oss_input+0x10/0x10
     __snd_seq_deliver_single_event+0x105/0x1a0
     ? snd_seq_port_use_ptr+0x111/0x170
     snd_seq_deliver_single_event+0x2fc/0x770
     ? __pfx_snd_seq_deliver_single_event+0x10/0x10
     ? srso_alias_return_thunk+0x5/0xfbef5
     ? add_lock_to_list+0x9d/0x1e0
     ? srso_alias_return_thunk+0x5/0xfbef5
     ? check_prev_add+0x34c/0xe80
     snd_seq_deliver_event+0x45a/0x760
     ? __pfx_snd_seq_deliver_event+0x10/0x10
     ? srso_alias_return_thunk+0x5/0xfbef5
     ? srso_alias_return_thunk+0x5/0xfbef5
     ? lock_acquire+0x17b/0x2f0
     snd_seq_client_enqueue_event.constprop.0+0x278/0x430
     ? __pfx_snd_seq_client_enqueue_event.constprop.0+0x10/0x10
     ? __might_fault+0xdd/0x190
     ? srso_alias_return_thunk+0x5/0xfbef5
     ? __might_fault+0x14e/0x190
     ? _raw_spin_unlock_irq+0x28/0x50
     snd_seq_write+0x30a/0x5e0
     ? __pfx_snd_seq_write+0x10/0x10
     ? selinux_file_permission+0x122/0x570
     ? srso_alias_return_thunk+0x5/0xfbef5
     ? security_file_permission+0x26/0x80
     vfs_write+0x25a/0x1010
     ? __pfx_snd_seq_write+0x10/0x10
     ? __pfx_vfs_write+0x10/0x10
     ? srso_alias_return_thunk+0x5/0xfbef5
     ? trace_hardirqs_on+0x18/0x160
     ? srso_alias_return_thunk+0x5/0xfbef5
     ? __call_rcu_common.constprop.0+0x5c1/0xbd0
     ? srso_alias_return_thunk+0x5/0xfbef5
     ? __fput+0x5ba/0xa60
     ksys_write+0x1b7/0x200
     ? __pfx_ksys_write+0x10/0x10
     do_syscall_64+0x115/0x6a0
     entry_SYSCALL_64_after_hwframe+0x77/0x7f
    RIP: 0033:0x7fdd13d31687
    Code: 48 89 fa 4c 89 df e8 58 b3 00 00 8b 93 08 03 00 00 59 5e 48 83 f8 fc 74 1a 5b c3 0f 1f 84 00 00 00 00 00 48 8b 44 24 10 0f 05 &lt;5b&gt; c3 0f 1f 80 00 00 00 00 83 e2 39 83 fa 08 75 de e8 23 ff ff ff
    RSP: 002b:00007fff073e9f20 EFLAGS: 00000202 ORIG_RAX: 0000000000000001
    RAX: ffffffffffffffda RBX: 00007fdd13c9f780 RCX: 00007fdd13d31687
    RDX: 000000000000001c RSI: 00007fff073e9fc0 RDI: 0000000000000003
    RBP: 0000000000000003 R08: 0000000000000000 R09: 0000000000000000
    R10: 0000000000000000 R11: 0000000000000202 R12: 0000561260c48082
    R13: 0000561260c48011 R14: 0000561260c4809d R15: 0000000000000002
     &lt;/TASK&gt;
    Modules linked in: snd_emux_validation(O)
    ---[ end trace 0000000000000000 ]---
    RIP: 0010:snd_emux_event_oss_input+0xa76/0xdd0
    Code: fc ff df 48 c1 ea 03 80 3c 02 00 0f 85 e1 02 00 00 48 b8 00 00 00 00 00 fc ff df 48 8b 5d 78 48 8d 7b 18 48 89 fa 48 c1 ea 03 &lt;0f&gt; b6 04 02 84 c0 74 08 3c 03 0f 8e 40 03 00 00 c7 43 18 00 00 00
    RSP: 0018:ffff88810a937888 EFLAGS: 00010216
    RAX: dffffc0000000000 RBX: 0000000000000000 RCX: ffffffff84f391b2
    RDX: 0000000000000003 RSI: 0000000000000000 RDI: 0000000000000018
    RBP: ffff8881179fc000 R08: 0000000000000001 R09: 0000000000000001
    R10: ffffffff89444257 R11: ffff888107dd3a00 R12: 1ffff11021526f17
    R13: 0000000000000000 R14: 0000000000000001 R15: ffff888112cda000
    FS:  00007fdd13c9f780(0000) GS:ffff8881fd826000(0000) knlGS:0000000000000000
    CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 00007fdd13e2f943 CR3: 00000001057ba005 CR4: 0000000000770ef0
    PKRU: 55555554
    Kernel panic - not syncing: Fatal exception
    Kernel Offset: disabled
    Rebooting in 1 seconds..

Assisted-by: LLM
Signed-off-by: Cen Zhang &lt;zzzccc427@gmail.com&gt;
Link: https://patch.msgid.link/pm-pmb-f8d6ccb28f196910444f-v2-c253bf022b6e954a7bdc@gmail.com
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>ALSA: seq: Use flexible array for MIDI channels</title>
<updated>2026-05-15T06:52:44+00:00</updated>
<author>
<name>Rosen Penev</name>
<email>rosenp@gmail.com</email>
</author>
<published>2026-05-11T07:54:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=cb02416507bc0c31415f1527aefc280ae96260bd'/>
<id>cb02416507bc0c31415f1527aefc280ae96260bd</id>
<content type='text'>
Store MIDI channel entries in the MIDI channel set allocation instead
of allocating them separately.

This ties the channel array lifetime directly to the channel set, removes
a separate allocation failure path, and lets __counted_by() describe the
array bounds. Move the embedded emux channel set to the end of its
containing structure so it can carry the flexible array.

Assisted-by: Codex:GPT-5.5
Signed-off-by: Rosen Penev &lt;rosenp@gmail.com&gt;
Link: https://patch.msgid.link/20260511075447.445350-1-rosenp@gmail.com
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Store MIDI channel entries in the MIDI channel set allocation instead
of allocating them separately.

This ties the channel array lifetime directly to the channel set, removes
a separate allocation failure path, and lets __counted_by() describe the
array bounds. Move the embedded emux channel set to the end of its
containing structure so it can carry the flexible array.

Assisted-by: Codex:GPT-5.5
Signed-off-by: Rosen Penev &lt;rosenp@gmail.com&gt;
Link: https://patch.msgid.link/20260511075447.445350-1-rosenp@gmail.com
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Convert remaining multi-line kmalloc_obj/flex GFP_KERNEL uses</title>
<updated>2026-02-22T16:26:33+00:00</updated>
<author>
<name>Kees Cook</name>
<email>kees@kernel.org</email>
</author>
<published>2026-02-22T07:46:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=189f164e573e18d9f8876dbd3ad8fcbe11f93037'/>
<id>189f164e573e18d9f8876dbd3ad8fcbe11f93037</id>
<content type='text'>
Conversion performed via this Coccinelle script:

  // SPDX-License-Identifier: GPL-2.0-only
  // Options: --include-headers-for-types --all-includes --include-headers --keep-comments
  virtual patch

  @gfp depends on patch &amp;&amp; !(file in "tools") &amp;&amp; !(file in "samples")@
  identifier ALLOC = {kmalloc_obj,kmalloc_objs,kmalloc_flex,
 		    kzalloc_obj,kzalloc_objs,kzalloc_flex,
		    kvmalloc_obj,kvmalloc_objs,kvmalloc_flex,
		    kvzalloc_obj,kvzalloc_objs,kvzalloc_flex};
  @@

  	ALLOC(...
  -		, GFP_KERNEL
  	)

  $ make coccicheck MODE=patch COCCI=gfp.cocci

Build and boot tested x86_64 with Fedora 42's GCC and Clang:

Linux version 6.19.0+ (user@host) (gcc (GCC) 15.2.1 20260123 (Red Hat 15.2.1-7), GNU ld version 2.44-12.fc42) #1 SMP PREEMPT_DYNAMIC 1970-01-01
Linux version 6.19.0+ (user@host) (clang version 20.1.8 (Fedora 20.1.8-4.fc42), LLD 20.1.8) #1 SMP PREEMPT_DYNAMIC 1970-01-01

Signed-off-by: Kees Cook &lt;kees@kernel.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Conversion performed via this Coccinelle script:

  // SPDX-License-Identifier: GPL-2.0-only
  // Options: --include-headers-for-types --all-includes --include-headers --keep-comments
  virtual patch

  @gfp depends on patch &amp;&amp; !(file in "tools") &amp;&amp; !(file in "samples")@
  identifier ALLOC = {kmalloc_obj,kmalloc_objs,kmalloc_flex,
 		    kzalloc_obj,kzalloc_objs,kzalloc_flex,
		    kvmalloc_obj,kvmalloc_objs,kvmalloc_flex,
		    kvzalloc_obj,kvzalloc_objs,kvzalloc_flex};
  @@

  	ALLOC(...
  -		, GFP_KERNEL
  	)

  $ make coccicheck MODE=patch COCCI=gfp.cocci

Build and boot tested x86_64 with Fedora 42's GCC and Clang:

Linux version 6.19.0+ (user@host) (gcc (GCC) 15.2.1 20260123 (Red Hat 15.2.1-7), GNU ld version 2.44-12.fc42) #1 SMP PREEMPT_DYNAMIC 1970-01-01
Linux version 6.19.0+ (user@host) (clang version 20.1.8 (Fedora 20.1.8-4.fc42), LLD 20.1.8) #1 SMP PREEMPT_DYNAMIC 1970-01-01

Signed-off-by: Kees Cook &lt;kees@kernel.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Convert more 'alloc_obj' cases to default GFP_KERNEL arguments</title>
<updated>2026-02-22T04:03:00+00:00</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2026-02-22T04:03:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=32a92f8c89326985e05dce8b22d3f0aa07a3e1bd'/>
<id>32a92f8c89326985e05dce8b22d3f0aa07a3e1bd</id>
<content type='text'>
This converts some of the visually simpler cases that have been split
over multiple lines.  I only did the ones that are easy to verify the
resulting diff by having just that final GFP_KERNEL argument on the next
line.

Somebody should probably do a proper coccinelle script for this, but for
me the trivial script actually resulted in an assertion failure in the
middle of the script.  I probably had made it a bit _too_ trivial.

So after fighting that far a while I decided to just do some of the
syntactically simpler cases with variations of the previous 'sed'
scripts.

The more syntactically complex multi-line cases would mostly really want
whitespace cleanup anyway.

Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This converts some of the visually simpler cases that have been split
over multiple lines.  I only did the ones that are easy to verify the
resulting diff by having just that final GFP_KERNEL argument on the next
line.

Somebody should probably do a proper coccinelle script for this, but for
me the trivial script actually resulted in an assertion failure in the
middle of the script.  I probably had made it a bit _too_ trivial.

So after fighting that far a while I decided to just do some of the
syntactically simpler cases with variations of the previous 'sed'
scripts.

The more syntactically complex multi-line cases would mostly really want
whitespace cleanup anyway.

Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Convert 'alloc_obj' family to use the new default GFP_KERNEL argument</title>
<updated>2026-02-22T01:09:51+00:00</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2026-02-22T00:37:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=bf4afc53b77aeaa48b5409da5c8da6bb4eff7f43'/>
<id>bf4afc53b77aeaa48b5409da5c8da6bb4eff7f43</id>
<content type='text'>
This was done entirely with mindless brute force, using

    git grep -l '\&lt;k[vmz]*alloc_objs*(.*, GFP_KERNEL)' |
        xargs sed -i 's/\(alloc_objs*(.*\), GFP_KERNEL)/\1)/'

to convert the new alloc_obj() users that had a simple GFP_KERNEL
argument to just drop that argument.

Note that due to the extreme simplicity of the scripting, any slightly
more complex cases spread over multiple lines would not be triggered:
they definitely exist, but this covers the vast bulk of the cases, and
the resulting diff is also then easier to check automatically.

For the same reason the 'flex' versions will be done as a separate
conversion.

Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This was done entirely with mindless brute force, using

    git grep -l '\&lt;k[vmz]*alloc_objs*(.*, GFP_KERNEL)' |
        xargs sed -i 's/\(alloc_objs*(.*\), GFP_KERNEL)/\1)/'

to convert the new alloc_obj() users that had a simple GFP_KERNEL
argument to just drop that argument.

Note that due to the extreme simplicity of the scripting, any slightly
more complex cases spread over multiple lines would not be triggered:
they definitely exist, but this covers the vast bulk of the cases, and
the resulting diff is also then easier to check automatically.

For the same reason the 'flex' versions will be done as a separate
conversion.

Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>treewide: Replace kmalloc with kmalloc_obj for non-scalar types</title>
<updated>2026-02-21T09:02:28+00:00</updated>
<author>
<name>Kees Cook</name>
<email>kees@kernel.org</email>
</author>
<published>2026-02-21T07:49:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=69050f8d6d075dc01af7a5f2f550a8067510366f'/>
<id>69050f8d6d075dc01af7a5f2f550a8067510366f</id>
<content type='text'>
This is the result of running the Coccinelle script from
scripts/coccinelle/api/kmalloc_objs.cocci. The script is designed to
avoid scalar types (which need careful case-by-case checking), and
instead replace kmalloc-family calls that allocate struct or union
object instances:

Single allocations:	kmalloc(sizeof(TYPE), ...)
are replaced with:	kmalloc_obj(TYPE, ...)

Array allocations:	kmalloc_array(COUNT, sizeof(TYPE), ...)
are replaced with:	kmalloc_objs(TYPE, COUNT, ...)

Flex array allocations:	kmalloc(struct_size(PTR, FAM, COUNT), ...)
are replaced with:	kmalloc_flex(*PTR, FAM, COUNT, ...)

(where TYPE may also be *VAR)

The resulting allocations no longer return "void *", instead returning
"TYPE *".

Signed-off-by: Kees Cook &lt;kees@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This is the result of running the Coccinelle script from
scripts/coccinelle/api/kmalloc_objs.cocci. The script is designed to
avoid scalar types (which need careful case-by-case checking), and
instead replace kmalloc-family calls that allocate struct or union
object instances:

Single allocations:	kmalloc(sizeof(TYPE), ...)
are replaced with:	kmalloc_obj(TYPE, ...)

Array allocations:	kmalloc_array(COUNT, sizeof(TYPE), ...)
are replaced with:	kmalloc_objs(TYPE, COUNT, ...)

Flex array allocations:	kmalloc(struct_size(PTR, FAM, COUNT), ...)
are replaced with:	kmalloc_flex(*PTR, FAM, COUNT, ...)

(where TYPE may also be *VAR)

The resulting allocations no longer return "void *", instead returning
"TYPE *".

Signed-off-by: Kees Cook &lt;kees@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>ALSA: synth: Use guard() for preset locks</title>
<updated>2025-09-01T11:54:27+00:00</updated>
<author>
<name>Takashi Iwai</name>
<email>tiwai@suse.de</email>
</author>
<published>2025-08-29T15:13:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=826f35b829f43dc62fb847eca6f79e8698b4994d'/>
<id>826f35b829f43dc62fb847eca6f79e8698b4994d</id>
<content type='text'>
Define a macro for the preset locking/unlocking pairs for soundfont
using guard() macro as a further code cleanup.

The new macro is put in soundfont.h (and some function renames) along
with it for avoiding unnecessary troubles with clang.

Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
Link: https://patch.msgid.link/20250829151335.7342-6-tiwai@suse.de
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Define a macro for the preset locking/unlocking pairs for soundfont
using guard() macro as a further code cleanup.

The new macro is put in soundfont.h (and some function renames) along
with it for avoiding unnecessary troubles with clang.

Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
Link: https://patch.msgid.link/20250829151335.7342-6-tiwai@suse.de
</pre>
</div>
</content>
</entry>
<entry>
<title>ALSA: synth: Use guard() for spin locks</title>
<updated>2025-09-01T11:54:26+00:00</updated>
<author>
<name>Takashi Iwai</name>
<email>tiwai@suse.de</email>
</author>
<published>2025-08-29T15:13:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=59ede7178d402b3bfa0266cbd9ad348d5612c295'/>
<id>59ede7178d402b3bfa0266cbd9ad348d5612c295</id>
<content type='text'>
Clean up the code using guard() for spin locks.

Merely code refactoring, and no behavior change.

Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
Link: https://patch.msgid.link/20250829151335.7342-5-tiwai@suse.de
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Clean up the code using guard() for spin locks.

Merely code refactoring, and no behavior change.

Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
Link: https://patch.msgid.link/20250829151335.7342-5-tiwai@suse.de
</pre>
</div>
</content>
</entry>
</feed>
