aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget
diff options
context:
space:
mode:
authorRobin Callender <robin_callender@hotmail.com>2009-08-02 14:38:58 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2009-09-23 09:46:32 -0400
commite792b1b0b83c276ca786b01cad662dc2e5d18843 (patch)
treef9b52743334a3395ac481571517624eff77589fb /drivers/usb/gadget
parent417b57b3e4e34df07a2aceaf75baffeacdd9385f (diff)
USB: gadget: audio driver seg-fault fix
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@hotmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/gadget')
-rw-r--r--drivers/usb/gadget/u_audio.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/usb/gadget/u_audio.c b/drivers/usb/gadget/u_audio.c
index 0f3d22fc030e..b5200d551458 100644
--- 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 gaudio *card)
253 snd->filp = filp_open(fn_cap, O_RDONLY, 0); 253 snd->filp = filp_open(fn_cap, O_RDONLY, 0);
254 if (IS_ERR(snd->filp)) { 254 if (IS_ERR(snd->filp)) {
255 ERROR(card, "No such PCM capture device: %s\n", fn_cap); 255 ERROR(card, "No such PCM capture device: %s\n", fn_cap);
256 snd->filp = NULL; 256 snd->substream = NULL;
257 snd->card = NULL;
258 } else {
259 pcm_file = snd->filp->private_data;
260 snd->substream = pcm_file->substream;
261 snd->card = card;
257 } 262 }
258 pcm_file = snd->filp->private_data;
259 snd->substream = pcm_file->substream;
260 snd->card = card;
261 263
262 return 0; 264 return 0;
263} 265}