Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp726726rwd; Tue, 16 May 2023 07:05:19 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7YMJyJkPfXcFMIeELGQJ5iwQUp2SfP/hDUsYTnS+b03JpikO7KRfkiSJhVWC1fQU+Ymb1w X-Received: by 2002:a05:6a20:394d:b0:104:8824:74eb with SMTP id r13-20020a056a20394d00b00104882474ebmr18508938pzg.51.1684245918968; Tue, 16 May 2023 07:05:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684245918; cv=none; d=google.com; s=arc-20160816; b=k2uN6J9jK2yOGGOaWFHX8mVeDG/OiOTC0VyanVFyw0VONB/rSgEa+xqmlGatx9E3Be 5p+7BuwAL1NJAfNOhgUHBOZSWUgWeFhI9pwbnfeaJodXFxu0BAyPB9Up7nChLWFIw5W1 a+QZSoqpKMRiblUj4/vIfMq4XuAwS9spjohfDoFwJcyi9llsVnTA0ZqUCNZ37v/ZqJsC YK3UPfgngfRdHM3ykv4GNG77oAEIUKRHoWaApRwdT6ndjutl7FZSFxjpM27bkM9Y+2Zk 2nWlAs0sXqxE7nphFrGaKTVfxsPI3/05L3aVxSPivvuiVLN0LSZs4MEshwA3StABVJEM 5nLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=j/UyIDr0rbqLOHWypuzZyfrXMXjfgmBZlfViI0pcpWE=; b=Pk+sUQKQ4tQFaOUZK3Ecnei0Lu6+oT8q+AJ9muRGq8bOf8s1ydDDpmj7thnkQWulpd HBP0fooP0JmeKmCayTLe53DL3kpTN3Hm+PXs7Fhg9COKFjX/qUU2ioGiN27QQC/+t4ew 4Dtz+FT2y0/6CtWeiFJnyjQvKqFQseRaiUTjyFFyo1rJCkKjoXnoqWp08q1M2+xRFdz6 MyimCs2BebOrfb5g/kKWm5b3cXz3UPVroFATNLCVqsWRRSu1MUncUnV9XBc3TPUqRTK2 ysA9IjufuPRlKP+R8eiJsdmPPkjJkUJmPANUVeM2NSO4NU58Rm/AmOH192FHjih/ooGz FurA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HSQN24GQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t188-20020a6378c5000000b0051b7f451cc6si17924088pgc.539.2023.05.16.07.04.58; Tue, 16 May 2023 07:05:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HSQN24GQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233248AbjEPNzE (ORCPT + 99 others); Tue, 16 May 2023 09:55:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233847AbjEPNy4 (ORCPT ); Tue, 16 May 2023 09:54:56 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE0E0212F; Tue, 16 May 2023 06:54:50 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 62D8C6106C; Tue, 16 May 2023 13:54:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 49B10C43445; Tue, 16 May 2023 13:54:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1684245289; bh=7hO0wxivdPOSFemSK4iAuWKSXV/MOYXS0sCdNmjdjOQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=HSQN24GQkZ9IAFB891bzAFzxcbDnsg/U4nQcnMmNlLykRUzIavVgBOWsQDR2pwTy1 Z9dIQeXr2OhXBl6yRnLLmexPJ67uaW07Hr8RI9qyPg1a9zjjeSOFvjbdlSliP6wF2P HQdHp+Ur/twnFjFPteGJzJojKBC0f1+B2or+OKds= Date: Tue, 16 May 2023 15:54:46 +0200 From: Greg KH To: syzbot Cc: linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, rafael@kernel.org, syzkaller-bugs@googlegroups.com Subject: Re: [syzbot] [usb?] memory leak in class_create Message-ID: <2023051628-thumb-boaster-5680@gregkh> References: <00000000000077472605faa4aad5@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <00000000000077472605faa4aad5@google.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 01, 2023 at 09:53:45AM -0700, syzbot wrote: > Hello, > > syzbot found the following issue on: > > HEAD commit: 22b8cc3e78f5 Merge tag 'x86_mm_for_6.4' of git://git.kerne.. > git tree: upstream > console output: https://syzkaller.appspot.com/x/log.txt?x=16fc7958280000 > kernel config: https://syzkaller.appspot.com/x/.config?x=5046ebeca744dd40 > dashboard link: https://syzkaller.appspot.com/bug?extid=e7afd76ad060fa0d2605 > compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2 > syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1599a2b4280000 > C reproducer: https://syzkaller.appspot.com/x/repro.c?x=14eb395fc80000 > > Downloadable assets: > disk image: https://storage.googleapis.com/syzbot-assets/3ad2088c196b/disk-22b8cc3e.raw.xz > vmlinux: https://storage.googleapis.com/syzbot-assets/61919a5b89c6/vmlinux-22b8cc3e.xz > kernel image: https://storage.googleapis.com/syzbot-assets/a7adb5503ac8/bzImage-22b8cc3e.xz #syz test: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/ 22b8cc3e78f5 diff --git a/drivers/base/class.c b/drivers/base/class.c index ac1808d1a2e8..9b44edc8416f 100644 --- a/drivers/base/class.c +++ b/drivers/base/class.c @@ -320,6 +322,7 @@ void class_dev_iter_init(struct class_dev_iter *iter, const struct class *class, start_knode = &start->p->knode_class; klist_iter_init_node(&sp->klist_devices, &iter->ki, start_knode); iter->type = type; + iter->sp = sp; } EXPORT_SYMBOL_GPL(class_dev_iter_init); @@ -361,6 +364,7 @@ EXPORT_SYMBOL_GPL(class_dev_iter_next); void class_dev_iter_exit(struct class_dev_iter *iter) { klist_iter_exit(&iter->ki); + subsys_put(iter->sp); } EXPORT_SYMBOL_GPL(class_dev_iter_exit); diff --git a/include/linux/device/class.h b/include/linux/device/class.h index 9deeaeb457bb..abf3d3bfb6fe 100644 --- a/include/linux/device/class.h +++ b/include/linux/device/class.h @@ -74,6 +74,7 @@ struct class { struct class_dev_iter { struct klist_iter ki; const struct device_type *type; + struct subsys_private *sp; }; int __must_check class_register(const struct class *class);