From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-oo1-f72.google.com (mail-oo1-f72.google.com [209.85.161.72]) (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 372A286331 for ; Sat, 25 Apr 2026 14:43:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.72 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777128199; cv=none; b=RtLnV51Z0r56ttTYRf9hYX6X55neO1ruUtYZWaiDh/zp8iuTjYswfYhEuaN7SdsNgM6rRmL6lt1xKU/YLRHOvZ7XBvjA8rw24D+i/gBF77HV6pnoDcu7X+nO8eXn4cL7dNrCu9/2/g52FDQC7fKHocikQbag3ZQL14/RAVNdDQs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777128199; c=relaxed/simple; bh=8TG5z52QQ4eYqaLu+9wMZnWogHrwPPWJiCHuQETfRCc=; h=MIME-Version:Date:In-Reply-To:Message-ID:Subject:From:To: Content-Type; b=PYd3Ek6Jc6Zf5fb1/6RGQpqW5+Go0SURi9EdbFu9f6vqQgen8d7+0bT8KwRYuQscbtCNsQswem3HhRyuJZWZjt7WzvmckfGyxjVQtKdEx8vZpoRSXOrZpLE07Bdm1Mn1p0YfZlQ+0MAizSEta4EHkg9N+SNZwOuFj5r3fdUlQxc= 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.161.72 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-oo1-f72.google.com with SMTP id 006d021491bc7-69634bfdfebso604877eaf.0 for ; Sat, 25 Apr 2026 07:43:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777128197; x=1777732997; 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=gINbnfl6M88k2uLDo8W9tyaHmOIs/+qHLUqJQw70F8Y=; b=OTnCNXpLKjfOp1jOlLA4LdOEwHgN4shhWEahpGDsy+yzt0h0pLnfBDSEESK7ExVcK/ BEc4rnsOyZeQBLrImAmGiH7lKm/QEiOW2N63cf4tSi+s/lGwPeiFM7Hh2onI5Ysxh+hK VrGcf4MXPwzEOcP2zQJUb7Jkz3/Mc2CLb9qsVoYyBpONd7MmEJ5L3vwC67yuZ6dwdgAu 1IdB6YtXcilBGeyG92WgDBqQmbThHIllNhzK9CWELD1vwxz/NjdNpTmUO5gpE+KCy535 qBCSKbNrSYFfWlGhU/ROOTOQfGwyH/krdOfzDzPx8hVQzVh+FHNNVy23X+QT3gLS8G55 kwfw== X-Gm-Message-State: AOJu0Yx8I8mE9W9iiWamqiSV+GL6sOyUKu8v1DUujpkK8yUB7bIh6ATc TwV7jAp8H/JJKFC10uU0gzRRQpS+Yy8azcc7fO2aUJC7J6+q6c9jeO4Ur+E1QRC8xAgEFvUCgBA VrPcWyMFYeWc0WpYPADHrPrjO7JX9c2oC9wQ3fkbl6J2fqMKJb0X/EeE5FdM= 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:61f:b0:694:854b:c155 with SMTP id 006d021491bc7-694854bc793mr13382138eaf.18.1777128197231; Sat, 25 Apr 2026 07:43:17 -0700 (PDT) Date: Sat, 25 Apr 2026 07:43:17 -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: <69ecd305.a00a0220.7773.001b.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 8af0c04041ee..ad9f744b496b 100644 --- a/sound/usb/caiaq/device.c +++ b/sound/usb/caiaq/device.c @@ -423,6 +423,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)); @@ -511,7 +512,6 @@ static int init_card(struct snd_usb_caiaqdev *cdev) scnprintf(card->longname, sizeof(card->longname), "%s %s (%s)", cdev->vendor_name, cdev->product_name, usbpath); - card->private_free = card_free; err = setup_card(cdev); if (err < 0) return err; -- 2.43.0