Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp3846701pxb; Mon, 4 Oct 2021 10:52:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwz47NLJIfk/GtcIj0h52HfyksBGO0LoOGVECQo8E34SDTeUdbRWNaILbzHlLb7I4WEd8MQ X-Received: by 2002:a17:906:facf:: with SMTP id lu15mr18790284ejb.93.1633369948715; Mon, 04 Oct 2021 10:52:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633369948; cv=none; d=google.com; s=arc-20160816; b=Nue1VYmWs5GEXATqBJDKVoH7ojldrsPP1Ii+xxdk3QR5JmEDn+8nsOcA5bkWHd1M55 7pNnDbVWYpKe+59YNXCzRMizLb9neBVbppKqyNNSJxLvCwD1yMWW3yfvEDzRihn5Cycc GXiCiAF3GuTd/tIjn6jvRdJSM34uYEWYccPwOjDCeaANsUNu27BLKXgOihsCn+uTsNpo HReL/ZrS6RmS1HLzTtzFUQ8Ifp+x9Jkqe0KCecuYYu6qbVhLlTzc2ZxKwNrs/9Cefpy/ +Gqeba3z7BMT8PQ/lbuZoRNXhRg94FeKuhJdtKyhxayQ8Y+VxiidvxFhoaH2n6FsrmUw 4q7A== 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=tAWxpwl8doA0MMBNMY6fAunhMduG3WDPici+oeYzeOg=; b=n7WgfBGpQVJlDSBJuGJwkl2eYa4v+VGM/7LxOHD4Qgtzmrr7gZiSng9tWb9/Aly+DB wDP2GchHE7erYQtM4Bs4I7Jh2WjyRPR2QtoYqGzeppWPdLSPdQobogFkTnZKfUkB5ttx 6OAYvAMuK7Np5Bg5r69cmlFLiljLnHycNT5lRs5vqnBU5eTYioJ44MB2brZPSlpc5Q3O 52DzuQ03KuMLV/aJvK0wotg2bf3RNKhFWGH3kQZWkd0WeuNssOu0XYQC9N0LZCNjOZ3G kkxzPcGjoIwejcazGDK+KX1jc5M7668Yqip0RGOKSrH2jP5WbgwaNwYNjvyaLVCI7e9b H+bg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=k3h6Yt6k; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f5si14469294edx.339.2021.10.04.10.52.04; Mon, 04 Oct 2021 10:52:28 -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=@gmail.com header.s=20210112 header.b=k3h6Yt6k; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235103AbhJDPal (ORCPT + 99 others); Mon, 4 Oct 2021 11:30:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234888AbhJDPak (ORCPT ); Mon, 4 Oct 2021 11:30:40 -0400 Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1EBC9C061746; Mon, 4 Oct 2021 08:28:51 -0700 (PDT) Received: by mail-pj1-x1031.google.com with SMTP id oa12-20020a17090b1bcc00b0019f715462a8so226746pjb.3; Mon, 04 Oct 2021 08:28:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=tAWxpwl8doA0MMBNMY6fAunhMduG3WDPici+oeYzeOg=; b=k3h6Yt6kJllNxWx4Ua7SlpDwoN4iNNDUJOCbBqOw3/ylPLnJkFD0ev/KHCfbLX2FPW WDp8POMCKLwIxwzB50y5afICh4h1KA9ZZCW0+IaTltaAN0ItGuzNLPn882P4R5pUVN9O DZ4eHW3jsfBlDNynjq0+ZdSSMzy1nkxcL6yHRCiARRpzPeJMMb45wnDmFHuXaVTq6Wq/ Ydy1pVQHuIGbovpUqlxqED5v/cEnYrBAhGEUHEbpmjyUQDUlVJRlsEDrBAzLYxjNH/Be 96aap1eCmIv7IZCgqTWhH7FOJEhzGgwzz0+yKs3tnzuxoNU+0qX+QpgBHXKUAKg8taHG +1OQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=tAWxpwl8doA0MMBNMY6fAunhMduG3WDPici+oeYzeOg=; b=Tyc6CGQWOK19NJGQKCU28TYPMzsHsiyvPLIeNxvcbRb7IrdeYv7eoQ4oNka6gxKRa2 Y/yCdpjbSjfSL6NWikH8VA2uWTSvc/KOo8Re4nJqIRzC32LzPb06XosOW21dYYkY6M1y 3PTP/YcCA/IJi3GqG7xywTIEyvE3aZD32Vwn7p/AOnsij5qQhu7z/VqFaxRGGf7p146V i6fUV1BMksOCkMtvR4r1cGDmvcpyYkXUOx9JBdFPU1WNgoq3hOUu0+EhzgyZtpG2WeWm ql/f89QRuQ4tmdb+eveGXQOZMyKRHUPFdobV+Fry0jZoq8ZhuYKeYzllcPtdD1jG6kGB BSxQ== X-Gm-Message-State: AOAM530+J7u3o7zAs0MRhLdMxQGjuIJ6FY53zy9ah/y/qmfgYm8wz0b1 jx3yljhDA/Xmy38Gs4gxGaw= X-Received: by 2002:a17:902:bf0a:b0:13d:f4b8:111 with SMTP id bi10-20020a170902bf0a00b0013df4b80111mr271185plb.35.1633361330474; Mon, 04 Oct 2021 08:28:50 -0700 (PDT) Received: from sol (106-69-170-56.dyn.iinet.net.au. [106.69.170.56]) by smtp.gmail.com with ESMTPSA id f20sm8669029pga.12.2021.10.04.08.28.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Oct 2021 08:28:49 -0700 (PDT) Date: Mon, 4 Oct 2021 23:28:44 +0800 From: Kent Gibson To: Heikki Krogerus Cc: Greg Kroah-Hartman , Andy Shevchenko , "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: <20211004152844.GA3825382@sol> References: <20211004093416.GA2513199@sol> <20211004121942.GA3343713@sol> <20211004124701.GA3418302@sol> <20211004141754.GA3510607@sol> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211004141754.GA3510607@sol> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 04, 2021 at 10:17:54PM +0800, Kent Gibson wrote: > On Mon, Oct 04, 2021 at 04:20:55PM +0300, Heikki Krogerus wrote: > > On Mon, Oct 04, 2021 at 08:47:01PM +0800, Kent Gibson wrote: > > > On Mon, Oct 04, 2021 at 03:30:43PM +0300, Heikki Krogerus wrote: > > > > On Mon, Oct 04, 2021 at 08:19:42PM +0800, Kent Gibson wrote: > > > > > On Mon, Oct 04, 2021 at 11:44:17AM +0200, Greg Kroah-Hartman wrote: > > > > > > On Mon, Oct 04, 2021 at 05:34:16PM +0800, Kent Gibson wrote: > > > > > > > Hi, > > > > > > > [snip] > > > Looking at the offending patch, it effectively replaces a call to > > > device_add_properties() with one to > > > device_create_managed_software_node(), and those two functions appear > > > quite different - at least at first glance. > > > Is that correct? > > > > The only real difference between the two functions is that > > device_create_managed_software_node() marks the software node it > > creates (and it does it exactly the same way as > > device_add_properties()) as "managed" with a specific flag. > > > That managed flag makes all the difference. I've tried to find a fix along the same lines as Laurentiu Tudor's 5aeb05b27f8 software node: balance refcount for managed software nodes but haven't found anything that works. What does work for me is to revert the call to device_create_managed_software_node() to a call to device_add_properties(): diff --git a/drivers/base/platform.c b/drivers/base/platform.c index 652531f67135..2f30bdb94fab 100644 --- a/drivers/base/platform.c +++ b/drivers/base/platform.c @@ -826,8 +826,7 @@ struct platform_device *platform_device_register_full( goto err; if (pdevinfo->properties) { - ret = device_create_managed_software_node(&pdev->dev, - pdevinfo->properties, NULL); + ret = device_add_properties(&pdev->dev, pdevinfo->properties); if (ret) goto err; } That obviously wont work with your latest series that removes device_add_properties(), but that is the simplest, and only, solution that I've found so far. Cheers, Kent.