summaryrefslogtreecommitdiff
path: root/sound/usb
diff options
context:
space:
mode:
authorJesper Juhl <jj@chaosbits.net>2010-10-29 20:40:23 +0200
committerTakashi Iwai <tiwai@suse.de>2010-11-01 10:23:39 +0100
commit8a8d56b2a2f9aa423c3d8b6b1e2792c0492059ed (patch)
tree03fa96d09560dcc68a059318a4100157d37da806 /sound/usb
parent89e1e66d6be8a520cdcd26043cda2cc870a34015 (diff)
ALSA: usb - driver neglects kmalloc return value check and may deref NULL
sound/usb/pcm.c::snd_usb_pcm_check_knot() fails to check the return value from kmalloc() and may end up dereferencing a null pointer. The patch below (compile tested only) should take care of that little problem. Signed-off-by: Jesper Juhl <jj@chaosbits.net> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb')
-rw-r--r--sound/usb/pcm.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c
index cff3a3c465d..4132522ac90 100644
--- a/sound/usb/pcm.c
+++ b/sound/usb/pcm.c
@@ -676,8 +676,10 @@ static int snd_usb_pcm_check_knot(struct snd_pcm_runtime *runtime,
if (!needs_knot)
return 0;
- subs->rate_list.count = count;
subs->rate_list.list = kmalloc(sizeof(int) * count, GFP_KERNEL);
+ if (!subs->rate_list.list)
+ return -ENOMEM;
+ subs->rate_list.count = count;
subs->rate_list.mask = 0;
count = 0;
list_for_each_entry(fp, &subs->fmt_list, list) {