Commit 0c5e2ae2 authored by Šerif Rami's avatar Šerif Rami Committed by Takashi Iwai
Browse files

ALSA: usb-audio: us144mkii: Fix null-deref in tascam_midi_in_urb_complete()



The smatch tool reported a potential null pointer dereference in
tascam_midi_in_urb_complete(). The 'tascam' variable, derived from
'urb->context', was checked for nullity in one place, but dereferenced
without a check in several other places.

This patch fixes the issue by adding a null check at the beginning of
the function. If 'tascam' is null, the function now safely exits.
This prevents any potential crashes from null pointer dereferences.

It also fixes a latent bug where 'usb_put_urb()' could
be called twice for the same URB on submission failure, which would
lead to a use-after-free error.

Fixes: 67afec15 ("ALSA: usb-audio: us144mkii: Add MIDI support and mixer controls")
Reported-by: default avatarDan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/r/202508192109.lcMrINK1-lkp@intel.com/


Signed-off-by: default avatarŠerif Rami <ramiserifpersia@gmail.com>
Link: https://patch.msgid.link/20250819185133.10464-1-ramiserifpersia@gmail.com


Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent d9f06338
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment