linux-stable/sound/firewire
Takashi Sakamoto b2b65c9013 ALSA: firewire-lib: fix uninitialized flag for AV/C deferred transaction
[ Upstream commit bf0cd60b7e ]

AV/C deferred transaction was supported at a commit 00a7bb81c2 ("ALSA:
firewire-lib: Add support for deferred transaction") while 'deferrable'
flag can be uninitialized for non-control/notify AV/C transactions.
UBSAN reports it:

kernel: ================================================================================
kernel: UBSAN: invalid-load in /build/linux-aa0B4d/linux-5.15.0/sound/firewire/fcp.c:363:9
kernel: load of value 158 is not a valid value for type '_Bool'
kernel: CPU: 3 PID: 182227 Comm: irq/35-firewire Tainted: P           OE     5.15.0-18-generic #18-Ubuntu
kernel: Hardware name: Gigabyte Technology Co., Ltd. AX370-Gaming 5/AX370-Gaming 5, BIOS F42b 08/01/2019
kernel: Call Trace:
kernel:  <IRQ>
kernel:  show_stack+0x52/0x58
kernel:  dump_stack_lvl+0x4a/0x5f
kernel:  dump_stack+0x10/0x12
kernel:  ubsan_epilogue+0x9/0x45
kernel:  __ubsan_handle_load_invalid_value.cold+0x44/0x49
kernel:  fcp_response.part.0.cold+0x1a/0x2b [snd_firewire_lib]
kernel:  fcp_response+0x28/0x30 [snd_firewire_lib]
kernel:  fw_core_handle_request+0x230/0x3d0 [firewire_core]
kernel:  handle_ar_packet+0x1d9/0x200 [firewire_ohci]
kernel:  ? handle_ar_packet+0x1d9/0x200 [firewire_ohci]
kernel:  ? transmit_complete_callback+0x9f/0x120 [firewire_core]
kernel:  ar_context_tasklet+0xa8/0x2e0 [firewire_ohci]
kernel:  tasklet_action_common.constprop.0+0xea/0xf0
kernel:  tasklet_action+0x22/0x30
kernel:  __do_softirq+0xd9/0x2e3
kernel:  ? irq_finalize_oneshot.part.0+0xf0/0xf0
kernel:  do_softirq+0x75/0xa0
kernel:  </IRQ>
kernel:  <TASK>
kernel:  __local_bh_enable_ip+0x50/0x60
kernel:  irq_forced_thread_fn+0x7e/0x90
kernel:  irq_thread+0xba/0x190
kernel:  ? irq_thread_fn+0x60/0x60
kernel:  kthread+0x11e/0x140
kernel:  ? irq_thread_check_affinity+0xf0/0xf0
kernel:  ? set_kthread_struct+0x50/0x50
kernel:  ret_from_fork+0x22/0x30
kernel:  </TASK>
kernel: ================================================================================

This commit fixes the bug. The bug has no disadvantage for the non-
control/notify AV/C transactions since the flag has an effect for AV/C
response with INTERIM (0x0f) status which is not used for the transactions
in AV/C general specification.

Fixes: 00a7bb81c2 ("ALSA: firewire-lib: Add support for deferred transaction")
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20220304125647.78430-1-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-04-20 09:08:15 +02:00
..
bebob ALSA: bebob: add support for ToneWeal FW66 2021-07-20 16:17:50 +02:00
dice ALSA: dice: fix error path to destroy initialized stream data 2018-05-01 12:58:14 -07:00
digi00x ALSA: firewire-digi00x: exclude Avid Adrenaline from detection 2020-09-09 19:03:11 +02:00
fireface ALSA: fireface: Fix integer overflow in transmit_midi_msg() 2021-01-23 15:48:45 +01:00
fireworks ALSA: fireworks: fix memory leak of response buffer at error path 2018-09-29 03:06:03 -07:00
motu ALSA: firewire-motu: Correct a typo in the clock proc string 2020-01-09 10:17:56 +01:00
oxfw Revert "ALSA: bebob/oxfw: fix Kconfig entry for Mackie d.2 Pro" 2021-07-20 16:17:48 +02:00
tascam ALSA: firewire-tascam: Fix integer overflow in midi_port_work() 2021-01-23 15:48:45 +01:00
amdtp-am824.c ALSA: firewire-lib/fireworks: fix miss detection of received MIDI messages 2019-07-10 09:54:39 +02:00
amdtp-am824.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
amdtp-stream-trace.h ALSA: firewire-lib: use the same print format for 'without_header' tracepoints 2019-01-09 17:14:47 +01:00
amdtp-stream.c ALSA: firewire-lib: fix wrong handling payload_length as payload_quadlet 2019-01-09 17:14:47 +01:00
amdtp-stream.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
cmp.c
cmp.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
fcp.c ALSA: firewire-lib: fix uninitialized flag for AV/C deferred transaction 2022-04-20 09:08:15 +02:00
fcp.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
isight.c ALSA: isight: fix leak of reference to firewire unit in error path of .probe callback 2019-12-01 09:13:16 +01:00
iso-resources.c ALSA: firewire: fix NULL pointer dereference when releasing uninitialized data of iso-resource 2017-08-20 09:40:32 +02:00
iso-resources.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
Kconfig ALSA: bebob: add support for ToneWeal FW66 2021-07-20 16:17:50 +02:00
lib.c ALSA: firewire-lib/firewire-tascam: localize async midi port 2017-04-14 14:50:26 +02:00
lib.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
packets-buffer.c ALSA: firewire: fix a memory leak bug 2019-08-16 10:13:56 +02:00
packets-buffer.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00