Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp3457536pxb; Mon, 4 Oct 2021 02:45:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzWZc84iAwSZxFUzeGjimzeiQaoYG8V3SfmrQtYYP14OJaFh9rtNK+iUNEaLtdvOamHVtIx X-Received: by 2002:a17:90a:5889:: with SMTP id j9mr35941341pji.91.1633340744641; Mon, 04 Oct 2021 02:45:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633340744; cv=none; d=google.com; s=arc-20160816; b=TSGdxG0PP5Xo+rCEKGA9tbAZBPfthAIlUstTrGAIcSpK4GR7zKVHC7awdOTk6R3Xvx 2KJrepaJ5KSo78/1pgI8y/QA8ZyuPvymHmN6bad9zi7ReRrELwUMhyGj7qE7Sj9HmZrv DNa/EXUBi9EYYh+UgfEONhGM47mqNXk1f/aBt9GS2pvOhoImMkD+f1Klmh2rTEVTv3Wl 1n9ZZuDBxikVDZv6fMgWG4eM1s3IfeGKIcCv7EwNF5TRqySJRdZ2ZD3HXqoA1VeElVeb 4wMzBt5JH3JNcO5kNNbaQybiURb2Ii/cw3630TpKT60Lv+a99sKM58BCXXy1/JjYUJlw L8EA== 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=ju7upCwdMXMDVM7kOzz5z/jqs0+9tz++NgfLcUxxF60=; b=0XBycd/RbfYTU8lWiwCE9qUbqchwbMDXXs6zBpKsdxbnpBo8KWRq6pW2Y8mR0MbQeB LNvVTatIWN+cj9cvX3D9mrfwD1k6BTplchvWy6SlWLM5STdnIcG+pitjQ6v0LakG28NB DMtJSHRqKNxMq2613wjnbxU+Qck6c6rOAKdYSdDv7O6rKHtcnxMRPUXRrp54tcdSSttr JRYnG3UJfej9SpccraC+Fav5oMJ9oWh/dFruWoVhlficUPw/1Y9QNkHI8UHfYO4yvsIl edvb5F35x0s+zEm6jSXmgQd8V6f5OGuQFO0tHPmo+Goda1+nzD59QxUQLNSSsHJf2tO5 K2sg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PurdbFyU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k2si5822173pjl.188.2021.10.04.02.45.30; Mon, 04 Oct 2021 02:45:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PurdbFyU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S232272AbhJDJqI (ORCPT + 99 others); Mon, 4 Oct 2021 05:46:08 -0400 Received: from mail.kernel.org ([198.145.29.99]:48004 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231962AbhJDJqH (ORCPT ); Mon, 4 Oct 2021 05:46:07 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id DD5826124B; Mon, 4 Oct 2021 09:44:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1633340659; bh=fk61M3UGDZbik4xQrIYyiZJxiHlmJ2ySY6kXmySER+s=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=PurdbFyUtnGgzBveLRsgnFFgIpBtnBI5T/WPmlrsXHY53rvnRWZQG2D+wazrgGNOc 18eaoPV5ppwkpI2LZz+KuwDkUzJ1fuHxKPmH7oD9+M/HGTqozUmFNAg5yrbxzj7FMP fuzOYJoEJ5bqggJHQTztq0XQCYub38yfgciglf1E= Date: Mon, 4 Oct 2021 11:44:17 +0200 From: Greg Kroah-Hartman To: Kent Gibson Cc: Andy Shevchenko , Heikki Krogerus , "Rafael J. Wysocki" , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski Subject: Re: linux 5.15-rc4: refcount underflow when unloading gpio-mockup Message-ID: References: <20211004093416.GA2513199@sol> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211004093416.GA2513199@sol> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 04, 2021 at 05:34:16PM +0800, Kent Gibson wrote: > Hi, > > I'm seeing a refcount underflow when I unload the gpio-mockup module on > Linux v5.15-rc4 (and going back to v5.15-rc1): > > # modprobe gpio-mockup gpio_mockup_ranges=-1,4,-1,10 > # rmmod gpio-mockup > ------------[ cut here ]------------ > refcount_t: underflow; use-after-free. > WARNING: CPU: 0 PID: 103 at lib/refcount.c:28 refcount_warn_saturate+0xd1/0x120 > Modules linked in: gpio_mockup(-) > CPU: 0 PID: 103 Comm: rmmod Not tainted 5.15.0-rc4 #1 > Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.13.0-1ubuntu1.1 04/01/2014 > EIP: refcount_warn_saturate+0xd1/0x120 > Code: e8 a2 b0 3b 00 0f 0b eb 83 80 3d db 2a 8c c1 00 0f 85 76 ff ff ff c7 04 24 88 85 78 c1 b1 01 88 0d db 2a 8c c1 e8 7d b0 3b 00 <0f> 0b e9 5b ff ff ff 80 3d d9 2a 8c c1 00 0f 85 4e ff ff ff c7 04 > EAX: 00000026 EBX: c250b100 ECX: f5fe8c28 EDX: 00000000 > ESI: c244860c EDI: c250b100 EBP: c245be84 ESP: c245be80 > DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068 EFLAGS: 00000296 > CR0: 80050033 CR2: b7e3c3e1 CR3: 024ba000 CR4: 00000690 > Call Trace: > kobject_put+0xdc/0xf0 > software_node_notify_remove+0xa8/0xc0 > device_del+0x15a/0x3e0 > ? kfree_const+0xf/0x30 > ? kobject_put+0xa6/0xf0 > ? module_remove_driver+0x73/0xa0 > platform_device_del.part.0+0xf/0x80 > platform_device_unregister+0x19/0x40 > gpio_mockup_unregister_pdevs+0x13/0x1b [gpio_mockup] > gpio_mockup_exit+0x1c/0x68c [gpio_mockup] > __ia32_sys_delete_module+0x137/0x1e0 > ? task_work_run+0x61/0x90 > ? exit_to_user_mode_prepare+0x1b5/0x1c0 > __do_fast_syscall_32+0x50/0xc0 > do_fast_syscall_32+0x32/0x70 > do_SYSENTER_32+0x15/0x20 > entry_SYSENTER_32+0x98/0xe7 > EIP: 0xb7eda549 > Code: b8 01 10 06 03 74 b4 01 10 07 03 74 b0 01 10 08 03 74 d8 01 00 00 00 00 00 00 00 00 00 00 00 00 00 51 52 55 89 e5 0f 34 cd 80 <5d> 5a 59 c3 90 90 90 90 8d 76 00 58 b8 77 00 00 00 cd 80 90 8d 76 > EAX: ffffffda EBX: 0045a19c ECX: 00000800 EDX: 0045a160 > ESI: fffffffe EDI: 0045a160 EBP: bff19d08 ESP: bff19cc8 > DS: 007b ES: 007b FS: 0000 GS: 0033 SS: 007b EFLAGS: 00000202 > ---[ end trace 3d71387f54bc2d06 ]--- > > I suspect this is related to the recent changes to swnode.c or > platform.c, as gpio-mockup hasn't changed, but haven't had the > chance to debug further. Any chance you can run 'git bisect' for this? thanks, greg k-h