Skip to content

Commit

Permalink
USB: gadget: audio driver seg-fault fix
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Robin Callender authored and Greg Kroah-Hartman committed Sep 23, 2009
1 parent 417b57b commit e792b1b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions drivers/usb/gadget/u_audio.c
Original file line number Diff line number Diff line change
Expand Up @@ -253,11 +253,13 @@ static int gaudio_open_snd_dev(struct gaudio *card)
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;
}
Expand Down

0 comments on commit e792b1b

Please sign in to comment.