From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ot1-f70.google.com (mail-ot1-f70.google.com [209.85.210.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E03C834C808 for ; Sat, 25 Apr 2026 12:55:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.70 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777121705; cv=none; b=Su2vcavSbDzodjyAp6v+XSTXwg0IqzTjfT/0fqgu1PuduFHlk3Yt9szX8ikrJwLrXNRcHQ44YumvVSGeTjXAs8b9vX277qP+bIdnrt2MZLQChshLbKKlZX2/7CeWc0EqC/9gL2YtEAtnSKV9baJJeR8faMM4wOF0FC2SDRzxQwk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777121705; c=relaxed/simple; bh=BVYfkuy1l2Fp+ylID6xUR9fgvNqIcu2QKj1wYb30mQ8=; h=MIME-Version:Date:In-Reply-To:Message-ID:Subject:From:To: Content-Type; b=byiC0kymicIsOgIrmZBttjlfdTYZJfMY8AJighHetwMfT/0RVE/C0MY/sIQc6Ip3KLbk4xGUXmetVsmZD0rYRrvC+y3HD9TIRtX1/V2/TaB+8NY9YCjIWxSWKBE4W76VK8Gn3oIyxiH2sfOhl3HPNpJj5bGSTlgpSaC9Dsb6Ze8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=syzkaller.appspotmail.com; spf=pass smtp.mailfrom=M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com; arc=none smtp.client-ip=209.85.210.70 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=syzkaller.appspotmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com Received: by mail-ot1-f70.google.com with SMTP id 46e09a7af769-7dbbb806e10so18290369a34.1 for ; Sat, 25 Apr 2026 05:55:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777121700; x=1777726500; h=to:from:subject:message-id:in-reply-to:date:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=eaGC96teICKzQoBMuIKMuEqh0v18LD7el8v/vBTM2J4=; b=ot1u6WWLb3/vWKdLRlVSakmiioTh8HeHAuOtb9w1Kmu1xSQvMUPBjHV4R+ktptg4PQ CGY8DE6NkNVVpww7b9Chg7fXzEuVdvL2Ws02t9sKSxPre1IzV5ar2wrdgb3RHu4ZgpZX Qkira1iwczA5BMqgQrkR05whgOVDJv0c+y4feWHx8a9t6XEYY2BgS1PBHPCCJluC1uiT fvXebD3I03dsY3qJFZ5gl8DANXvMeQPFYj7NXw/ZoI3YIESdqNtZBc+sWEMBqW4z7f/C QuvuqfceKv/0HBa6kCcZlDph1+HL2H5GqRvtlvtwMy9AakP+XsmmK3g3GvBekCeTD5xO IbGA== X-Gm-Message-State: AOJu0YxbE3kbVPVLDLrzGDk/+NlmJ5ImtOAxihK3fPpbeq9eGPMUy6M3 ScnfZn3IPkmVCv0sZGPm97urqUecp5Ej1UhFgnVqzjMOw6rTII0hUFZFLhbxzPSMgavLbPDJwcA bwNsOT9HoCHY7lhC/Y6VUN6LzI3bPii1QMa/xNWObwrsv+MyK0C1reht4KFY= Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Received: by 2002:a05:6820:61d:b0:694:a4a6:7272 with SMTP id 006d021491bc7-694a4a676e4mr10027656eaf.59.1777121699953; Sat, 25 Apr 2026 05:54:59 -0700 (PDT) Date: Sat, 25 Apr 2026 05:54:59 -0700 In-Reply-To: <69ec231a.a00a0220.7773.000c.GAE@google.com> X-Google-Appengine-App-Id: s~syzkaller X-Google-Appengine-App-Id-Alias: syzkaller Message-ID: <69ecb9a3.a00a0220.7773.0019.GAE@google.com> Subject: Forwarded: [PATCH] ALSA: caiaq: fix usb_dev refcount leak on probe failure From: syzbot To: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com Content-Type: text/plain; charset="UTF-8" For archival purposes, forwarding an incoming command email to linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com. *** Subject: [PATCH] ALSA: caiaq: fix usb_dev refcount leak on probe failure Author: kartikey406@gmail.com #syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master create_card() takes a reference on the USB device with usb_get_dev() and stores the matching usb_put_dev() in card_free(), which is installed as the snd_card's ->private_free destructor. However, ->private_free is only assigned near the end of init_card(), after several failure points (usb_set_interface(), EP type checks, usb_submit_urb(), the EP1_CMD_GET_DEVICE_INFO exchange, and its timeout). When any of those fail, init_card() returns an error to snd_probe(), which calls snd_card_free(card). Because ->private_free is still NULL, card_free() never runs, the usb_get_dev() reference is not dropped, and the struct usb_device leaks along with its descriptor allocations and device_private. syzbot reproduces this with a malformed UAC3 device whose only valid altsetting is 0; init_card()'s usb_set_interface(usb_dev, 0, 1) call fails with -EIO and triggers the leak. Move the ->private_free assignment into create_card(), immediately after usb_get_dev(), so that every error path reaching snd_card_free() balances the reference. card_free()'s callees (snd_usb_caiaq_input_free, free_urbs, kfree) already tolerate the partially-initialized state because the chip private area is zero-initialized by snd_card_new(). Reported-by: syzbot+2afd7e71155c7e241560@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=2afd7e71155c7e241560 Signed-off-by: Deepanshu Kartikey --- sound/usb/caiaq/device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/usb/caiaq/device.c b/sound/usb/caiaq/device.c index 51177ebfb8c6..f084a0f782ad 100644 --- a/sound/usb/caiaq/device.c +++ b/sound/usb/caiaq/device.c @@ -411,6 +411,7 @@ static int create_card(struct usb_device *usb_dev, cdev = caiaqdev(card); cdev->chip.dev = usb_get_dev(usb_dev); + card->private_free = card_free; cdev->chip.card = card; cdev->chip.usb_id = USB_ID(le16_to_cpu(usb_dev->descriptor.idVendor), le16_to_cpu(usb_dev->descriptor.idProduct)); @@ -500,7 +501,6 @@ static int init_card(struct snd_usb_caiaqdev *cdev) cdev->vendor_name, cdev->product_name, usbpath); setup_card(cdev); - card->private_free = card_free; return 0; err_kill_urb: -- 2.43.0