mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-25 10:19:47 +00:00
ALSA: usx2y: fix a double free bug
In usX2Y_In04_init(), a new urb is firstly created through usb_alloc_urb() and saved to 'usX2Y->In04urb'. Then, a buffer is allocated through kmalloc() and saved to 'usX2Y->In04Buf'. If the allocation of the buffer fails, the error code ENOMEM is returned after usb_free_urb(), which frees the created urb. However, the urb is actually freed at card->private_free callback, i.e., snd_usX2Y_card_private_free(). So the free operation here leads to a double free bug. To fix the above issue, simply remove usb_free_urb(). Signed-off-by: Wenwen Wang <wang6495@umn.edu> Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
b60ee2e281
commit
cbb88db76a
1 changed files with 1 additions and 3 deletions
|
@ -293,10 +293,8 @@ int usX2Y_In04_init(struct usX2Ydev *usX2Y)
|
||||||
if (! (usX2Y->In04urb = usb_alloc_urb(0, GFP_KERNEL)))
|
if (! (usX2Y->In04urb = usb_alloc_urb(0, GFP_KERNEL)))
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
if (! (usX2Y->In04Buf = kmalloc(21, GFP_KERNEL))) {
|
if (! (usX2Y->In04Buf = kmalloc(21, GFP_KERNEL)))
|
||||||
usb_free_urb(usX2Y->In04urb);
|
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
|
||||||
|
|
||||||
init_waitqueue_head(&usX2Y->In04WaitQueue);
|
init_waitqueue_head(&usX2Y->In04WaitQueue);
|
||||||
usb_fill_int_urb(usX2Y->In04urb, usX2Y->dev, usb_rcvintpipe(usX2Y->dev, 0x4),
|
usb_fill_int_urb(usX2Y->In04urb, usX2Y->dev, usb_rcvintpipe(usX2Y->dev, 0x4),
|
||||||
|
|
Loading…
Reference in a new issue