Skip to content

Commit

Permalink
ALSA: caiaq: Fix stray URB at probe error path
Browse files Browse the repository at this point in the history
caiaq driver doesn't kill the URB properly at its error path during
the probe, which may lead to a use-after-free error later.  This patch
addresses it.

Reported-by: Johan Hovold <johan@kernel.org>
Reviewed-by: Johan Hovold <johan@kernel.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
  • Loading branch information
Takashi Iwai committed Oct 11, 2017
1 parent 7110599 commit 99fee50
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions sound/usb/caiaq/device.c
Original file line number Diff line number Diff line change
Expand Up @@ -469,10 +469,12 @@ static int init_card(struct snd_usb_caiaqdev *cdev)

err = snd_usb_caiaq_send_command(cdev, EP1_CMD_GET_DEVICE_INFO, NULL, 0);
if (err)
return err;
goto err_kill_urb;

if (!wait_event_timeout(cdev->ep1_wait_queue, cdev->spec_received, HZ))
return -ENODEV;
if (!wait_event_timeout(cdev->ep1_wait_queue, cdev->spec_received, HZ)) {
err = -ENODEV;
goto err_kill_urb;
}

usb_string(usb_dev, usb_dev->descriptor.iManufacturer,
cdev->vendor_name, CAIAQ_USB_STR_LEN);
Expand Down Expand Up @@ -507,6 +509,10 @@ static int init_card(struct snd_usb_caiaqdev *cdev)

setup_card(cdev);
return 0;

err_kill_urb:
usb_kill_urb(&cdev->ep1_in_urb);
return err;
}

static int snd_probe(struct usb_interface *intf,
Expand Down

0 comments on commit 99fee50

Please sign in to comment.