From patchwork Sat Jul 16 07:07:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liang He X-Patchwork-Id: 1657083 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=126.com header.i=@126.com header.a=rsa-sha256 header.s=s110527 header.b=YmlRZEaa; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=2404:9400:2:0:216:3eff:fee1:b9f1; helo=lists.ozlabs.org; envelope-from=linuxppc-dev-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2404:9400:2:0:216:3eff:fee1:b9f1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LlK815Zv7z9ryY for ; Sat, 16 Jul 2022 17:08:33 +1000 (AEST) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4LlK811CPpz3c2H for ; Sat, 16 Jul 2022 17:08:33 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=126.com header.i=@126.com header.a=rsa-sha256 header.s=s110527 header.b=YmlRZEaa; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=126.com (client-ip=123.126.96.4; helo=mail-m964.mail.126.com; envelope-from=windhl@126.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=126.com header.i=@126.com header.a=rsa-sha256 header.s=s110527 header.b=YmlRZEaa; dkim-atps=neutral Received: from mail-m964.mail.126.com (mail-m964.mail.126.com [123.126.96.4]) by lists.ozlabs.org (Postfix) with ESMTP id 4LlK7m2Hrjz3bk8 for ; Sat, 16 Jul 2022 17:08:17 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=126.com; s=s110527; h=From:Subject:Date:Message-Id:MIME-Version; bh=G4+E4 sZ9N86jww+cwk3X8PcwDDray6y5sBGpO/F5BTY=; b=YmlRZEaa7gxSlT3/zre+N 3R9NHRjklfMkwung82GmSKed2OAjv/CRxZ36ITDZx5t6OaruODbc7En5a5eb4MGy QQ5sfs2vM3SHZUmnnWu2tP81Uhygpy0UXeBQajLRsdUR4/4CCZYH9+wGf2kHPyov bQxD/sHJtV9AbDBDzej4FA= Received: from localhost.localdomain (unknown [124.16.139.61]) by smtp9 (Coremail) with SMTP id NeRpCgB3KsfPY9JiMZntGg--.65219S2; Sat, 16 Jul 2022 15:08:00 +0800 (CST) From: Liang He To: benh@kernel.crashing.org, mpe@ellerman.id.au, paulus@samba.org, linuxppc-dev@lists.ozlabs.org, windhl@126.com Subject: [PATCH] powerpc/powermac/low_i2c: Fix refcount leak bug in kw_i2c_probe() Date: Sat, 16 Jul 2022 15:07:58 +0800 Message-Id: <20220716070758.539434-1-windhl@126.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-CM-TRANSID: NeRpCgB3KsfPY9JiMZntGg--.65219S2 X-Coremail-Antispam: 1Uf129KBjvdXoW7XFyrGw45CF13CF13ZF45GFg_yoW3tFb_Jw n7GF9rCrs3ArsY9Fn0vFy5Wr1rJr98J3WUGF1jqay3Ja45XayDGw4UC347Way7urWYv39x GF95Kr9xAayFvjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IUU_WrtUUUUU== X-Originating-IP: [124.16.139.61] X-CM-SenderInfo: hzlqvxbo6rjloofrz/1tbi7RBAF1pEAaLUpAAAsn X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linuxppc-dev-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" We should call of_node_put() for the reference 'parent' returned by of_get_parent() which has increased the refcount. Fixes: 730745a5c450 ("[PATCH] 1/5 powerpc: Rework PowerMac i2c part 1") Signed-off-by: Liang He --- arch/powerpc/platforms/powermac/low_i2c.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/powerpc/platforms/powermac/low_i2c.c b/arch/powerpc/platforms/powermac/low_i2c.c index c1c430c66dc9..40f3aa432fba 100644 --- a/arch/powerpc/platforms/powermac/low_i2c.c +++ b/arch/powerpc/platforms/powermac/low_i2c.c @@ -627,6 +627,7 @@ static void __init kw_i2c_probe(void) if (parent == NULL) continue; chans = parent->name[0] == 'u' ? 2 : 1; + of_node_put(parent); for (i = 0; i < chans; i++) kw_i2c_add(host, np, np, i); } else {