From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ot1-f71.google.com (mail-ot1-f71.google.com [209.85.210.71]) (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 69E843770B for ; Sat, 25 Apr 2026 06:36:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.71 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777098999; cv=none; b=WWsUyF97nuJt6IOQ84pjcUhkrnyIMXnFO5cc14kn9hl/CmN/1gjsnOlglV6Kcff6n/EYRPkYUnu2IckANG0biSz+kWl3fGxlG9mIdjZFE0fN6uYNQnGA/pjSwq7MuBqNgQeaagBeI4SkhPY3UFWUVYO89EtYmpf80k4MLz8EH88= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777098999; c=relaxed/simple; bh=XcYxQ0xXDZKbTW+lzERr2LS7spFAeidk6FIedTJhseI=; h=MIME-Version:Date:In-Reply-To:Message-ID:Subject:From:To: Content-Type; b=hKilkXODtOwVRjKL7zvYdCbit8pDdfHnEgLUzdiVAx1pniODXzPHvZY+4ZFp/q/okOVLq7vTp6vHoG06lT3xr5vHXgID2FulB2RhvXgPphKfON1p3iWvUtSy0plyxKO4v5kpWHYL+6TOkzO/BQBjIuo8IRVs5xTzpwt79izN6yg= 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.71 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-f71.google.com with SMTP id 46e09a7af769-7dbb6b95836so17525767a34.3 for ; Fri, 24 Apr 2026 23:36:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777098997; x=1777703797; 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=dFVXIFtizpRI6vYyzRRtpQgIjnNor8Jq5FF9xUS6HEw=; b=KA/aCo0jjpKrCVl8Zj7K4Qw74p5FFdvqtjM2nVMgmuGZJbYvIEOeK1tDGIpTCtbIye mL2TqwJOA/+LiHu45XnOIdSfsw3wD1Ct4Wpo9txVXWmCmnDWaNWDIllXVMSTIHhd2xZU PndPCB424dm46rA30+UZp8f80riXx+bges9FHX6kOmOapJFNV00jjx9J2Q3xh7474OVw 0g8LN2fJk3lt91hHfzLMhEun041knB4xXAWlXLjOk1hMbeMNaJQeGBJRzbDsmwntUjnP 9Q/B5W4UWb78GWP7PZlAIguozOjL8QtyuU6iL2QzADTFjO31Dhe381tX6YrMfz9FXtHU 6gmA== X-Gm-Message-State: AOJu0YyNrhvVB2+RO6zkuYV65XR9jU2JA/6fZyc1eNX6wNDLhkufkurO 7onQctFwO4+zUVnX1h9T/k6B+8KjktmnswO6o3SWXq1jTAeizY86+vSkLsTayhJY13ZAzN1Tje3 UBsg7/aHleRYdxvIGXJHHkKBhkl3KuWxnNne6k9kzIL3MnRcDl/cleywU2ok= 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:188b:b0:694:9720:65e0 with SMTP id 006d021491bc7-69497206ca5mr12508085eaf.39.1777098997146; Fri, 24 Apr 2026 23:36:37 -0700 (PDT) Date: Fri, 24 Apr 2026 23:36:37 -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: <69ec60f5.a00a0220.1901e8.0004.GAE@google.com> Subject: Forwarded: [PATCH] usb: core: fix memory leak in usb_new_device() error path 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] usb: core: fix memory leak in usb_new_device() error path Author: kartikey406@gmail.com #syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master When usb_new_device() fails, it jumps to the 'fail' label which calls pm_runtime_disable() but never balances the earlier pm_runtime_get_noresume() call made at the top of the function. This leaves the PM runtime usage count elevated, preventing usb_put_dev() in hub_port_connect() from dropping the refcount to zero. As a result, usb_release_dev() never fires and usb_destroy_configuration() is never called, leaking all memory allocated during enumeration: - struct usb_device (2048 bytes) via usb_alloc_dev() - raw config descriptor (1024 bytes) via usb_get_configuration() - config metadata ( 8 bytes) via usb_get_configuration() - interface descriptor ( 64 bytes) via usb_parse_configuration() - struct device_private ( 256 bytes) via device_private_init() Fix this by adding pm_runtime_put_noidle() on the fail path to balance the pm_runtime_get_noresume() at the top of the function. pm_runtime_put_noidle() is correct here rather than pm_runtime_put() because we are in a teardown path and must not trigger autosuspend scheduling. Reported-by: syzbot+2afd7e71155c7e241560@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=2afd7e71155c7e241560 Signed-off-by: Deepanshu kartikey --- drivers/usb/core/hub.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 24960ba9caa9..148fadfbc30b 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -2733,6 +2733,7 @@ int usb_new_device(struct usb_device *udev) usb_set_device_state(udev, USB_STATE_NOTATTACHED); pm_runtime_disable(&udev->dev); pm_runtime_set_suspended(&udev->dev); + pm_runtime_put_noidle(&udev->dev); return err; } -- 2.43.0