|
Takashi Iwai |
150423 |
From cf59e1e4c79bf741905484cdb13c130b53576a16 Mon Sep 17 00:00:00 2001
|
|
Takashi Iwai |
150423 |
From: Baisong Zhong <zhongbaisong@huawei.com>
|
|
Takashi Iwai |
150423 |
Date: Mon, 21 Nov 2022 19:16:30 +0800
|
|
Takashi Iwai |
150423 |
Subject: [PATCH] ALSA: seq: fix undefined behavior in bit shift for SNDRV_SEQ_FILTER_USE_EVENT
|
|
Takashi Iwai |
150423 |
Git-commit: cf59e1e4c79bf741905484cdb13c130b53576a16
|
|
Takashi Iwai |
150423 |
Patch-mainline: v6.2-rc1
|
|
Takashi Iwai |
150423 |
References: git-fixes
|
|
Takashi Iwai |
150423 |
|
|
Takashi Iwai |
150423 |
Shifting signed 32-bit value by 31 bits is undefined, so changing
|
|
Takashi Iwai |
150423 |
significant bit to unsigned. The UBSAN warning calltrace like below:
|
|
Takashi Iwai |
150423 |
|
|
Takashi Iwai |
150423 |
Ubsan: shift-out-of-bounds in sound/core/seq/seq_clientmgr.c:509:22
|
|
Takashi Iwai |
150423 |
left shift of 1 by 31 places cannot be represented in type 'int'
|
|
Takashi Iwai |
150423 |
...
|
|
Takashi Iwai |
150423 |
Call Trace:
|
|
Takashi Iwai |
150423 |
<TASK>
|
|
Takashi Iwai |
150423 |
dump_stack_lvl+0x8d/0xcf
|
|
Takashi Iwai |
150423 |
ubsan_epilogue+0xa/0x44
|
|
Takashi Iwai |
150423 |
__ubsan_handle_shift_out_of_bounds+0x1e7/0x208
|
|
Takashi Iwai |
150423 |
snd_seq_deliver_single_event.constprop.21+0x191/0x2f0
|
|
Takashi Iwai |
150423 |
snd_seq_deliver_event+0x1a2/0x350
|
|
Takashi Iwai |
150423 |
snd_seq_kernel_client_dispatch+0x8b/0xb0
|
|
Takashi Iwai |
150423 |
snd_seq_client_notify_subscription+0x72/0xa0
|
|
Takashi Iwai |
150423 |
snd_seq_ioctl_subscribe_port+0x128/0x160
|
|
Takashi Iwai |
150423 |
snd_seq_kernel_client_ctl+0xce/0xf0
|
|
Takashi Iwai |
150423 |
snd_seq_oss_create_client+0x109/0x15b
|
|
Takashi Iwai |
150423 |
alsa_seq_oss_init+0x11c/0x1aa
|
|
Takashi Iwai |
150423 |
do_one_initcall+0x80/0x440
|
|
Takashi Iwai |
150423 |
kernel_init_freeable+0x370/0x3c3
|
|
Takashi Iwai |
150423 |
kernel_init+0x1b/0x190
|
|
Takashi Iwai |
150423 |
ret_from_fork+0x1f/0x30
|
|
Takashi Iwai |
150423 |
</TASK>
|
|
Takashi Iwai |
150423 |
|
|
Takashi Iwai |
150423 |
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
|
|
Takashi Iwai |
150423 |
Signed-off-by: Baisong Zhong <zhongbaisong@huawei.com>
|
|
Takashi Iwai |
150423 |
Link: https://lore.kernel.org/r/20221121111630.3119259-1-zhongbaisong@huawei.com
|
|
Takashi Iwai |
150423 |
Signed-off-by: Takashi Iwai <tiwai@suse.de>
|
|
Takashi Iwai |
150423 |
|
|
Takashi Iwai |
150423 |
---
|
|
Takashi Iwai |
150423 |
include/uapi/sound/asequencer.h | 8 ++++----
|
|
Takashi Iwai |
150423 |
1 file changed, 4 insertions(+), 4 deletions(-)
|
|
Takashi Iwai |
150423 |
|
|
Takashi Iwai |
150423 |
diff --git a/include/uapi/sound/asequencer.h b/include/uapi/sound/asequencer.h
|
|
Takashi Iwai |
150423 |
index 6d4a2c60808d..00d2703e8fca 100644
|
|
Takashi Iwai |
150423 |
--- a/include/uapi/sound/asequencer.h
|
|
Takashi Iwai |
150423 |
+++ b/include/uapi/sound/asequencer.h
|
|
Takashi Iwai |
150423 |
@@ -328,10 +328,10 @@ typedef int __bitwise snd_seq_client_type_t;
|
|
Takashi Iwai |
150423 |
#define KERNEL_CLIENT ((__force snd_seq_client_type_t) 2)
|
|
Takashi Iwai |
150423 |
|
|
Takashi Iwai |
150423 |
/* event filter flags */
|
|
Takashi Iwai |
150423 |
-#define SNDRV_SEQ_FILTER_BROADCAST (1<<0) /* accept broadcast messages */
|
|
Takashi Iwai |
150423 |
-#define SNDRV_SEQ_FILTER_MULTICAST (1<<1) /* accept multicast messages */
|
|
Takashi Iwai |
150423 |
-#define SNDRV_SEQ_FILTER_BOUNCE (1<<2) /* accept bounce event in error */
|
|
Takashi Iwai |
150423 |
-#define SNDRV_SEQ_FILTER_USE_EVENT (1<<31) /* use event filter */
|
|
Takashi Iwai |
150423 |
+#define SNDRV_SEQ_FILTER_BROADCAST (1U<<0) /* accept broadcast messages */
|
|
Takashi Iwai |
150423 |
+#define SNDRV_SEQ_FILTER_MULTICAST (1U<<1) /* accept multicast messages */
|
|
Takashi Iwai |
150423 |
+#define SNDRV_SEQ_FILTER_BOUNCE (1U<<2) /* accept bounce event in error */
|
|
Takashi Iwai |
150423 |
+#define SNDRV_SEQ_FILTER_USE_EVENT (1U<<31) /* use event filter */
|
|
Takashi Iwai |
150423 |
|
|
Takashi Iwai |
150423 |
struct snd_seq_client_info {
|
|
Takashi Iwai |
150423 |
int client; /* client number to inquire */
|
|
Takashi Iwai |
150423 |
--
|
|
Takashi Iwai |
150423 |
2.35.3
|
|
Takashi Iwai |
150423 |
|