Re: [PATCH] usb gadget audio driver seg-fault fix

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

 



On Sat, 2009-08-01 at 10:28 -0700, Greg KH wrote:
> On Fri, Jul 31, 2009 at 10:02:23PM -0700, Robin Callender wrote:
> > ----- Original Message ----- 
> > From: "Greg KH" <greg@xxxxxxxxx>
> > To: "Robin Callender" <robin_callender@xxxxxxxxxxx>
> > Cc: "linux-usb" <linux-usb@xxxxxxxxxxxxxxx>
> > Sent: Friday, July 31, 2009 8:42 PM
> > Subject: Re: [PATCH] usb gadget audio driver seg-fault fix
> > 
> > 
> > > On Fri, Jul 31, 2009 at 06:05:24PM -0700, Robin Callender wrote:
> > >> Hi all,
> > >> The included patch can be applied to the new usb gadget audio driver
> > >> introduced in patch-2.6.31-rc4.
> > >> 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.
> > >>
> > >>  - Robin Callender -

> > Here is a re-do of the patch and sign-off-by tag.
> > 
> > One additional piece of info; the system I found problem on was a server (HP 
> > ML330-G3 with ubuntu 9.04).
> > This machine does not have a sound card, either built-in or add-on.
> > Rather I use a set of USB speakers for the playback device and a USB 
> > microphone for the capture device.
> > At the time of the seg-fault, the USB Microphone was not plugged in.
> > This explains why the device /dev/snd/pcmC0D0c (FILE_PCM_CAPTURE) is not 
> > present.
> > 

> The format is much better, thanks, but your email client wrapped the
> lines, and ate all of the leading tabs, which still makes it impossible
> to apply :(
> 
> Care to read the file, Documentation/email_clients.txt to give you some
> hints on how to fix this?
> 
> thanks,
> 
> greg k-h
> --


Signed-off-by: Robin Callender <robin_callender@xxxxxxxxxxx>


diff -uprN linux-2.6.30.4.orig/drivers/usb/gadget/u_audio.c linux-2.6.30.4/drivers/usb/gadget/u_audio.c
--- linux-2.6.30.4.orig/drivers/usb/gadget/u_audio.c	2009-07-31 13:37:12.000000000 -0700
+++ linux-2.6.30.4/drivers/usb/gadget/u_audio.c	2009-07-31 13:29:59.000000000 -0700
@@ -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