Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp188232rwb; Mon, 26 Sep 2022 10:56:03 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4mz3JoDxEpGr7TyhdxeGCPL2Opl+F4UC1M2pOOeiMF31o1g56o6BxfQWsU2Cgr/XgfPavC X-Received: by 2002:a17:90b:224d:b0:203:a209:f4d5 with SMTP id hk13-20020a17090b224d00b00203a209f4d5mr38212662pjb.135.1664214962848; Mon, 26 Sep 2022 10:56:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664214962; cv=none; d=google.com; s=arc-20160816; b=SoefoC8WbghE1CZkbxOJZMIXNq9U9uUTzFOFXMJhz/zE++2/3HGfNkFbwHxoOZQStI 9gRf7BEiUNZGEnn6WzN7FBb+8C5bVqo6cAITXKen0n9+t1zGjBcn50mHrcdmrSyTDXnr j1qTpEeydEC94VSYEjKNilf1zZII+u2LCthTWBaYjQsy2WW2+ZxJ4rPNkbU2Xph2tP1O PW1a8MA8cigHsMwSLaL3ughMucDpRTkkXqKILWvKiOeQaMAUFFH1tFxLvUPOLf71Ov6c beYDvoLxHxXlLbGS/GITC62QP1Ss4aoyz214ZhifDFWPZdIc+sw4Z18famkHvwYhoM5R N60Q== 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=i09WUO/PX3SCpwtmN2UCQt6f8m+8Dg/1gbFJjQGFMW8=; b=dS2Gj1rgKxme3UcemPAtYY18Dj3vb7hNCsrk2tjpYnhOLCtiryWes5cxBuzDqXtzeW x8ayeSp+WmgmpdVWiHNurfmECDV7HDNLCXb0JO/BtMtX3VnOGEf5wpf1U/opI9+LawNE cPbUln8WhWW6xi+/bgsrLnPWXwrjBSx0wrehSOIyZG56R0ouDWR8/ZKbVGUkOCeDY/mz RYB939zHCmS0xNvZFoYJieVir7DxJDv1bPRn0c0MAI3eA8MZgT2GLfobRDIJECIooHlY FFaM/iwRjTR0LU40Hidq1x3Zl1S8hAsrARKUAvN+2jlySJT/Qwwy5ZcCRJDyIaJTKurP NY8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sTkkzq8T; 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 e14-20020a17090301ce00b001784c98bfddsi15156680plh.24.2022.09.26.10.55.51; Mon, 26 Sep 2022 10:56:02 -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=sTkkzq8T; 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 S230221AbiIZRF7 (ORCPT + 99 others); Mon, 26 Sep 2022 13:05:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56462 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230082AbiIZRFS (ORCPT ); Mon, 26 Sep 2022 13:05:18 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84945285; Mon, 26 Sep 2022 09:08:39 -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 ams.source.kernel.org (Postfix) with ESMTPS id 4296AB80AE6; Mon, 26 Sep 2022 16:08:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 93BEDC433C1; Mon, 26 Sep 2022 16:08:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664208516; bh=fXfxc6TThtN6R0aValrqgfLYhMHz+jsHRMWsyysHKcc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=sTkkzq8TsQm58Uqstew5WUz717zu9BSCjtpfQPKvus2H3oFze5XK3jfAiu6+T3USU 0G5HCK6alKm9DPym1vSiWC8/1Kwq8keZsKMqrRYEes8TAHXYY0FipvMkknpQvW8spu KMlSIlw7GrERCoUGf8WAm0irQurcyljq9c4flJr8= Date: Mon, 26 Sep 2022 18:08:34 +0200 From: Greg Kroah-Hartman To: Pavel Machek Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org, Liang He , Thomas Bogendoerfer , Sasha Levin Subject: Re: [PATCH 4.9 10/30] mips/pic32/pic32mzda: Fix refcount leak bugs Message-ID: References: <20220926100736.153157100@linuxfoundation.org> <20220926100736.537955607@linuxfoundation.org> <20220926104042.GD8978@amd> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220926104042.GD8978@amd> X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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, Sep 26, 2022 at 12:40:42PM +0200, Pavel Machek wrote: > Hi! > > > [ Upstream commit eb9e9bc4fa5fb489c92ec588b3fb35f042ba6d86 ] > > > > of_find_matching_node(), of_find_compatible_node() and > > of_find_node_by_path() will return node pointers with refcout > > incremented. We should call of_node_put() when they are not > > used anymore. > > True. But we absolutely should not call put when we still use the > reference. > > > +++ b/arch/mips/pic32/pic32mzda/init.c > > @@ -131,13 +131,18 @@ static int __init pic32_of_prepare_platform_data(struct of_dev_auxdata *lookup) > > np = of_find_compatible_node(NULL, NULL, lookup->compatible); > > if (np) { > > lookup->name = (char *)np->name; > > - if (lookup->phys_addr) > > + if (lookup->phys_addr) { > > + of_node_put(np); > > continue; > > + } > > if (!of_address_to_resource(np, 0, &res)) > > lookup->phys_addr = res.start; > > + of_node_put(np); > > } > > } > > As we stored np->name in lookup, we should not be putting that node, > we are still using it. Now dropped, thanks. greg k-h