2938dd26 | 13-Nov-2024 |
Takashi Iwai <tiwai@suse.de> |
ALSA: us122l: Use snd_card_free_when_closed() at disconnection
[ Upstream commit b7df09bb348016943f56b09dcaafe221e3f73947 ]
The USB disconnect callback is supposed to be short and not too-long wait
ALSA: us122l: Use snd_card_free_when_closed() at disconnection
[ Upstream commit b7df09bb348016943f56b09dcaafe221e3f73947 ]
The USB disconnect callback is supposed to be short and not too-long waiting. OTOH, the current code uses snd_card_free() at disconnection, but this waits for the close of all used fds, hence it can take long. It eventually blocks the upper layer USB ioctls, which may trigger a soft lockup.
An easy workaround is to replace snd_card_free() with snd_card_free_when_closed(). This variant returns immediately while the release of resources is done asynchronously by the card device release at the last close.
The loop of us122l->mmap_count check is dropped as well. The check is useless for the asynchronous operation with *_when_closed().
Fixes: 030a07e44129 ("ALSA: Add USB US122L driver") Signed-off-by: Takashi Iwai <tiwai@suse.de> Link: https://patch.msgid.link/20241113111042.15058-3-tiwai@suse.de Signed-off-by: Sasha Levin <sashal@kernel.org>
show more ...
|
2ac7a12e | 17-May-2021 |
Takashi Iwai <tiwai@suse.de> |
ALSA: usx2y: Cleanup probe and disconnect callbacks
Minor code refactoring by merging the superfluous function calls. The functions were split in the past for covering pre-history USB driver code, b
ALSA: usx2y: Cleanup probe and disconnect callbacks
Minor code refactoring by merging the superfluous function calls. The functions were split in the past for covering pre-history USB driver code, but this is utterly useless.
Link: https://lore.kernel.org/r/20210517131545.27252-11-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
show more ...
|
cae0cf65 | 17-May-2021 |
Takashi Iwai <tiwai@suse.de> |
ALSA: usx2y: Don't call free_pages_exact() with NULL address
Unlike some other functions, we can't pass NULL pointer to free_pages_exact(). Add a proper NULL check for avoiding possible Oops.
Link
ALSA: usx2y: Don't call free_pages_exact() with NULL address
Unlike some other functions, we can't pass NULL pointer to free_pages_exact(). Add a proper NULL check for avoiding possible Oops.
Link: https://lore.kernel.org/r/20210517131545.27252-10-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
show more ...
|
64a06f19 | 17-May-2021 |
Takashi Iwai <tiwai@suse.de> |
ALSA: usx2y: Fix shmem initialization
Currently us428ctls_shmem pages are allocated dynamically upon the mmap call, but this is quite racy. Since the shared memory itself is mandatory for the mmap,
ALSA: usx2y: Fix shmem initialization
Currently us428ctls_shmem pages are allocated dynamically upon the mmap call, but this is quite racy. Since the shared memory itself is mandatory for the mmap, let's allocate it at the beginning of the card initialization. Also, fix the initialization of the wait queue, too.
Link: https://lore.kernel.org/r/20210517131545.27252-9-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
show more ...
|
c1f24841 | 17-May-2021 |
Takashi Iwai <tiwai@suse.de> |
ALSA: usxy2: Fix potential doubly allocations
The PCM shmem pages are allocated in snd_usx2y_usbpcm_prepare(). Theoretically the prepare callback may be called simultaneously for both playback and c
ALSA: usxy2: Fix potential doubly allocations
The PCM shmem pages are allocated in snd_usx2y_usbpcm_prepare(). Theoretically the prepare callback may be called simultaneously for both playback and capture, hence this allocation can be racy.
Make sure that the allocation is performed exclusively by extending the pcm_mutex lock to cover the allocation code, too.
Link: https://lore.kernel.org/r/20210517131545.27252-8-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
show more ...
|
02d382af | 17-May-2021 |
Takashi Iwai <tiwai@suse.de> |
ALSA: usx2y: Fix potential memory leaks
Theoretically the initialization functions in usx2y drivers may be called multiple times as the driver gets initialized via hwpdep ioctl. Meanwhile, those fu
ALSA: usx2y: Fix potential memory leaks
Theoretically the initialization functions in usx2y drivers may be called multiple times as the driver gets initialized via hwpdep ioctl. Meanwhile, those functions including memory allocations don't check whether they are called twice, and they forget the old resources, which would lead to memory leaks.
This patch adds the sanity checks about the doubly initializations to give kernel WARNING, and returns an error in such a case. Also, each allocation assures to release the resources at its error path properly.
Link: https://lore.kernel.org/r/20210517131545.27252-7-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
show more ...
|
a11aa853 | 17-May-2021 |
Takashi Iwai <tiwai@suse.de> |
ALSA: usx2y: Avoid self-killing
The initialization os usx2y driver is multi-staged, and the PCM and other device creations are done after the DSP is loaded and initialized. Upon the initialization,
ALSA: usx2y: Avoid self-killing
The initialization os usx2y driver is multi-staged, and the PCM and other device creations are done after the DSP is loaded and initialized. Upon the initialization, when an error happens, the driver tries to call snd_card_free(). But this is dangerous, and in general, the driver cannot kill itself during its operation. Hence better to drop the snd_card_free() call from there.
Link: https://lore.kernel.org/r/20210517131545.27252-6-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
show more ...
|
4e268db7 | 17-May-2021 |
Takashi Iwai <tiwai@suse.de> |
ALSA: usx2y: Fix potential leaks of uninitialized memory
usx2y drivers may expose the allocated pages via mmap, but it performs zero-clear only for the struct size, not aligned with the page size. T
ALSA: usx2y: Fix potential leaks of uninitialized memory
usx2y drivers may expose the allocated pages via mmap, but it performs zero-clear only for the struct size, not aligned with the page size. This leaves out some uninitialized trailing bytes.
This patch fixes the clearance to cover all memory that are exposed to user-space.
Link: https://lore.kernel.org/r/20210517131545.27252-5-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
show more ...
|
a829dd5b | 17-May-2021 |
Takashi Iwai <tiwai@suse.de> |
ALSA: usx2y: Coding style fixes
This patch fixes various trivial coding-style issues in usx2y code, such as: * the assginments in if condition * comparison order with constants * NULL / zero checks
ALSA: usx2y: Coding style fixes
This patch fixes various trivial coding-style issues in usx2y code, such as: * the assginments in if condition * comparison order with constants * NULL / zero checks * unsigned -> unsigned int * addition of braces in control blocks * debug print with function names * move local variables in block into function head * reduction of too nested indentations
No functional changes.
Link: https://lore.kernel.org/r/20210517131545.27252-4-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
show more ...
|
4c0a58ef | 17-May-2021 |
Takashi Iwai <tiwai@suse.de> |
ALSA: usx2y: Fix spaces
This patch corrects merely the spaces in the usx2y code, including the superfluous trailing space in the debug prints and a slight reformat of some comment lines. Nothing re
ALSA: usx2y: Fix spaces
This patch corrects merely the spaces in the usx2y code, including the superfluous trailing space in the debug prints and a slight reformat of some comment lines. Nothing really touches about the code itself.
Link: https://lore.kernel.org/r/20210517131545.27252-3-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
show more ...
|
f2460238 | 23-Sep-2020 |
Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
sound: usx2y: move to use usb_control_msg_send()
The usb_control_msg_send() call can handle data on the stack, as well as returning an error if a "short" write happens, so move the driver over to us
sound: usx2y: move to use usb_control_msg_send()
The usb_control_msg_send() call can handle data on the stack, as well as returning an error if a "short" write happens, so move the driver over to using that call instead. This ends up removing a helper function that is no longer needed.
v2: API change in usb_control_msg_send()
Cc: Jaroslav Kysela <perex@perex.cz> Reviewed-by: Takashi Iwai <tiwai@suse.de> Link: https://lore.kernel.org/r/20200914153756.3412156-7-gregkh@linuxfoundation.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Link: https://lore.kernel.org/r/20200923134348.23862-10-oneukum@suse.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
show more ...
|