From patchwork Mon Oct 24 11:30:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9115 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp456164wru; Mon, 24 Oct 2022 06:33:41 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4D1e37sJcIEbHxiplKjvwIne1iwVEvHHbes3dPXat4UTKbZay3THXks9vNJRpnLzmC9fUh X-Received: by 2002:a05:6402:10c2:b0:45c:3c87:721f with SMTP id p2-20020a05640210c200b0045c3c87721fmr31968757edu.251.1666618421470; Mon, 24 Oct 2022 06:33:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618421; cv=none; d=google.com; s=arc-20160816; b=Z7ELIz7zDtUihPoYhKHJXMKGKddUASPdz7wua3Uvei7Vqe4jerYc9mQ3qIhBfk3rru B4FtXcpOu9GgpJKWFKMX/aIno+5oiRbiEhgdm4T1S6mULLOoYd2fmwfQJD2Q5zE0tO5P eq+sGR/o9FVdU85VlIJYzrsbo9kwpPgsmXGy/n98DP9pt1rsDItVhONcDlN71qOdapix eHF5pfv5LPyw1S35M4/FebzU9eIbJfXvswBgFBOnJP+jfU7o3dUOCkX0FmRHrv5HaJkH s61ibs2iEWAkMl487IcGVJKnoNxV8fwHUzmT8LgENRmh528KNh8vqcmqUFtSDz1a3ltZ gEhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=FQoIe7ktJmDTjQSNBl3d1Q1buF7U+4SVqEiDxhw/g4g=; b=XDqw3Py+zF1hGewj0Yxa/1Wrt/MpnHiN5TfBF3nNWSudP/Eh0hCKsDlqNvIWcB6xyj GWFKHXsvjru6kpry+FbxVFmR9kQVQxqKgiUWIE5nPH5t9pOS7cHPEFf0u1Dy9D+uhxJ9 uQzVJztoglnSEwaTwlH638w7wPZl9ihdPrfk2ShreEHm/IasrWdEqwFKVCDy+L5syKQv AKVFMrAxWIAYUPHIx05Z8h3FxbXe2OII5yGeospQLtGXPLFjwr87CKsHXKY2CJePZ2TP spmETrpeZtuwhGf3VBh08bl9Y7hBM+BXLmyN8xXVbhxU3q07Yp9NHbGbFvia+jtYi1+1 h39g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AK4q3fUK; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m13-20020a50ef0d000000b00461a2654335si4270002eds.425.2022.10.24.06.33.16; Mon, 24 Oct 2022 06:33:41 -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=AK4q3fUK; 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 S235884AbiJXNQa (ORCPT + 99 others); Mon, 24 Oct 2022 09:16:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45648 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236101AbiJXNOr (ORCPT ); Mon, 24 Oct 2022 09:14:47 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3FA1DA23EC; Mon, 24 Oct 2022 05:25:36 -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 59BF1B81289; Mon, 24 Oct 2022 12:09:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AE78EC433C1; Mon, 24 Oct 2022 12:09:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613364; bh=YCXQS2xzc48G6OVfeIwrWrM+RKOJvvmspSjHPzG5Owo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AK4q3fUKJTgLgXLYKcxOJsRuo5PU/pK3SBjqvHojMbKj3EFfmvzPzJ5ga5bzbaex1 J7weXY98U6/mHmc80/Rxe+Bxv63J1R/Mfan8dGPXnL5b+yZ/mmrjNwCmXun4Ebp1kn BNlm7/yqmxm45cwMjOv8GkETNceQU+6hPj0dSuT4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Krzysztof Kozlowski , Sasha Levin Subject: [PATCH 5.4 108/255] memory: pl353-smc: Fix refcount leak bug in pl353_smc_probe() Date: Mon, 24 Oct 2022 13:30:18 +0200 Message-Id: <20221024113006.059859095@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576078143011171?= X-GMAIL-MSGID: =?utf-8?q?1747576078143011171?= From: Liang He [ Upstream commit 61b3c876c1cbdb1efd1f52a1f348580e6e14efb6 ] The break of for_each_available_child_of_node() needs a corresponding of_node_put() when the reference 'child' is not used anymore. Here we do not need to call of_node_put() in fail path as '!match' means no break. While the of_platform_device_create() will created a new reference by 'child' but it has considered the refcounting. Fixes: fee10bd22678 ("memory: pl353: Add driver for arm pl353 static memory controller") Signed-off-by: Liang He Signed-off-by: Krzysztof Kozlowski Link: https://lore.kernel.org/r/20220716031324.447680-1-windhl@126.com Signed-off-by: Sasha Levin --- drivers/memory/pl353-smc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/memory/pl353-smc.c b/drivers/memory/pl353-smc.c index cc01979780d8..322d7ead0031 100644 --- a/drivers/memory/pl353-smc.c +++ b/drivers/memory/pl353-smc.c @@ -416,6 +416,7 @@ static int pl353_smc_probe(struct amba_device *adev, const struct amba_id *id) if (init) init(adev, child); of_platform_device_create(child, NULL, &adev->dev); + of_node_put(child); return 0;