Skip to content

Commit 5b01343

Browse files
tiwaigregkh
authored andcommitted
ALSA: caiaq: Fix stray URB at probe error path
commit 99fee508245825765ff60155fed43f970ff83a8f upstream. 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> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent ca2523c commit 5b01343

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

sound/usb/caiaq/device.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -469,10 +469,12 @@ static int init_card(struct snd_usb_caiaqdev *cdev)
469469

470470
err = snd_usb_caiaq_send_command(cdev, EP1_CMD_GET_DEVICE_INFO, NULL, 0);
471471
if (err)
472-
return err;
472+
goto err_kill_urb;
473473

474-
if (!wait_event_timeout(cdev->ep1_wait_queue, cdev->spec_received, HZ))
475-
return -ENODEV;
474+
if (!wait_event_timeout(cdev->ep1_wait_queue, cdev->spec_received, HZ)) {
475+
err = -ENODEV;
476+
goto err_kill_urb;
477+
}
476478

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

508510
setup_card(cdev);
509511
return 0;
512+
513+
err_kill_urb:
514+
usb_kill_urb(&cdev->ep1_in_urb);
515+
return err;
510516
}
511517

512518
static int snd_probe(struct usb_interface *intf,

0 commit comments

Comments
 (0)