From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-oo1-f70.google.com (mail-oo1-f70.google.com [209.85.161.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 3524029CE9 for ; Sat, 25 Apr 2026 07:52:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.70 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777103524; cv=none; b=oFFFiy2So1b16+9PGhGp7KFOgKwArHozxH4KtlR/mHNLFiWxq9oFiNZzd65izBwdWFMokBMgh1o6H7FbY4gycM8BvP95vAHS8YBdRYtNV3SVTbyHdyrTPiRhQDb+lD+W8BAh3MMNUk9zxd68HdrnFDShwnGO21DvSHAGnhrFicM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777103524; c=relaxed/simple; bh=BVYfkuy1l2Fp+ylID6xUR9fgvNqIcu2QKj1wYb30mQ8=; h=MIME-Version:Date:In-Reply-To:Message-ID:Subject:From:To: Content-Type; b=sIq9Xlunbu87PIvwwii6pmsXk3h/Cmd48aK05AsbZfqSn3fh1v6cZ1UpoefF++XcbtxH/LjBdkAi9r7nzGQoDiMHJavaUA0331QhMk+QDAdKloOx0lMTf042BjifQxYHL2jwB+5Wk9mFKsg5/N9xQOUFPPQfzUUUTFqt8CQLzk8= 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.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-oo1-f70.google.com with SMTP id 006d021491bc7-696266291d6so1554550eaf.1 for ; Sat, 25 Apr 2026 00:52:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777103522; x=1777708322; 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=UvrpPXhSlaAu+YaWVnZbCLOmVi0EjW30jBWPKyn5uDUNa5VUk9OaMh33xxEPDc+ipk +6C83nR/yItbhmqatTmm8nnMLaHeC28/OtXW2Vp9+r09CZYb7XisO5aD8jT+j37hkj5+ uIbGfuratJ8fOfgi83dnCq5j0cN9j1UU77Pd5VuHIcgdmVgJNr6lh/7bF7IWngjwEajt 0cUrRmbyNrMV0VAqTom/sx8VtVgBJ8zHHtwxzkWCZ+EKjfYUyUcUFeUQYwoz9osjlY7m Re4NEzGMUIlju1nEjyfqCaoHBlZqk6Ds2SNXqgMRYAKSaePo9qTNv6fRJZWHeQSf92AS 5BCw== X-Gm-Message-State: AOJu0YzVNyFQWmO3pKdUGKpqqjqn1AD2NimcJHaYUWbldRqyiDs/TuCJ Kh06o8WHYIyjE/tgyHw18ZL8zDt0H4oB78NbHwrCnERaGlkHtbv8tLy2LI3CMlTwrR/fVCQ9P08 rhViycaQax/DZZSlLSeYjp/9jfF+m+RwIzIfhVSau2VXf/M4z5ZB22dRW8v0= 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:2002:b0:694:9175:9d47 with SMTP id 006d021491bc7-6949175acafmr13050940eaf.18.1777103522152; Sat, 25 Apr 2026 00:52:02 -0700 (PDT) Date: Sat, 25 Apr 2026 00:52:02 -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: <69ec72a2.a00a0220.7773.000f.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