patch usb-gadget-audio-driver-seg-fault-fix.patch added to gregkh-2.6 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

    Subject: USB: gadget: audio driver seg-fault fix

to my gregkh-2.6 tree.  Its filename is

    usb-gadget-audio-driver-seg-fault-fix.patch

This tree can be found at 
    http://www.kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/patches/


>From robin_callender@xxxxxxxxxxx  Fri Aug  7 16:58:23 2009
From: Robin Callender <robin_callender@xxxxxxxxxxx>
Date: Sun, 02 Aug 2009 11:38:58 -0700
Subject: USB: gadget: audio driver seg-fault fix
To: linux-usb <linux-usb@xxxxxxxxxxxxxxx>
Message-ID: <BLU0-SMTP381C57E876EC4E964935AA920E0@xxxxxxx>


The included patch can be applied to the new usb gadget audio driver.

It addresses a seg-fault in uncovered in g_audio.ko.
The fault occurs in the function u_audio.c::gaudio_open_end_dev() when
device /dev/snd/pcmC0D0c (FILE_PCM_CAPTURE) is not present.

I suspect there may be similar problems with device /dev/snd/pcmC0D0p
(FILE_PCM_PLAYBACK) handling also.  I leave that for the developer(s),
as I was unsure as to the side-effects of not calling
playback_default_hw_params() in the initialization phase.

Signed-off-by: Robin Callender <robin_callender@xxxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxx>


---
 drivers/usb/gadget/u_audio.c |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

--- a/drivers/usb/gadget/u_audio.c
+++ b/drivers/usb/gadget/u_audio.c
@@ -253,11 +253,13 @@ static int gaudio_open_snd_dev(struct ga
 	snd->filp = filp_open(fn_cap, O_RDONLY, 0);
 	if (IS_ERR(snd->filp)) {
 		ERROR(card, "No such PCM capture device: %s\n", fn_cap);
-		snd->filp = NULL;
+		snd->substream = NULL;
+		snd->card = NULL;
+	} else {
+		pcm_file = snd->filp->private_data;
+		snd->substream = pcm_file->substream;
+		snd->card = card;
 	}
-	pcm_file = snd->filp->private_data;
-	snd->substream = pcm_file->substream;
-	snd->card = card;
 
 	return 0;
 }

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux