Patch "ALSA: usb-audio: Fix NULL dererence at error path" has been added to the 6.0-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    ALSA: usb-audio: Fix NULL dererence at error path

to the 6.0-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     alsa-usb-audio-fix-null-dererence-at-error-path.patch
and it can be found in the queue-6.0 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.


>From 568be8aaf8a535f79c4db76cabe17b035aa2584d Mon Sep 17 00:00:00 2001
From: Takashi Iwai <tiwai@xxxxxxx>
Date: Fri, 30 Sep 2022 12:01:29 +0200
Subject: ALSA: usb-audio: Fix NULL dererence at error path

From: Takashi Iwai <tiwai@xxxxxxx>

commit 568be8aaf8a535f79c4db76cabe17b035aa2584d upstream.

At an error path to release URB buffers and contexts, the driver might
hit a NULL dererence for u->urb pointer, when u->buffer_size has been
already set but the actual URB allocation failed.

Fix it by adding the NULL check of urb.  Also, make sure that
buffer_size is cleared after the error path or the close.

Cc: <stable@xxxxxxxxxxxxxxx>
Reported-by: Sabri N. Ferreiro <snferreiro1@xxxxxxxxx>
Link: https://lore.kernel.org/r/CAKG+3NRjTey+fFfUEGwuxL-pi_=T4cUskYG9OzpzHytF+tzYng@xxxxxxxxxxxxxx
Link: https://lore.kernel.org/r/20220930100129.19445-1-tiwai@xxxxxxx
Signed-off-by: Takashi Iwai <tiwai@xxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 sound/usb/endpoint.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/sound/usb/endpoint.c
+++ b/sound/usb/endpoint.c
@@ -93,12 +93,13 @@ static inline unsigned get_usb_high_spee
  */
 static void release_urb_ctx(struct snd_urb_ctx *u)
 {
-	if (u->buffer_size)
+	if (u->urb && u->buffer_size)
 		usb_free_coherent(u->ep->chip->dev, u->buffer_size,
 				  u->urb->transfer_buffer,
 				  u->urb->transfer_dma);
 	usb_free_urb(u->urb);
 	u->urb = NULL;
+	u->buffer_size = 0;
 }
 
 static const char *usb_error_string(int err)


Patches currently in stable-queue which might be from tiwai@xxxxxxx are

queue-6.0/alsa-rawmidi-drop-register_mutex-in-snd_rawmidi_free.patch
queue-6.0/alsa-oss-fix-potential-deadlock-at-unregistration.patch
queue-6.0/alsa-usb-audio-fix-potential-memory-leaks.patch
queue-6.0/alsa-hda-realtek-add-quirk-for-asus-gv601r-laptop.patch
queue-6.0/alsa-hda-realtek-correct-pin-configs-for-asus-g533z.patch
queue-6.0/alsa-hda-realtek-remove-alc289_fixup_dual_spk-for-dell-5530.patch
queue-6.0/alsa-hda-realtek-add-intel-reference-ssid-to-support-headset-keys.patch
queue-6.0/alsa-usb-audio-fix-null-dererence-at-error-path.patch



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux