From patchwork Sat Jun 18 06:08:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liang He X-Patchwork-Id: 1644988 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=BDwaWrtJ; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=112.213.38.117; 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 [112.213.38.117]) (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 4LQ5B25w4Gz9s75 for ; Sat, 18 Jun 2022 16:10:33 +1000 (AEST) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4LQ59y28fdz3bsc for ; Sat, 18 Jun 2022 16:10:30 +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=BDwaWrtJ; 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=220.181.15.112; helo=m15112.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=BDwaWrtJ; dkim-atps=neutral Received: from m15112.mail.126.com (m15112.mail.126.com [220.181.15.112]) by lists.ozlabs.org (Postfix) with ESMTP id 4LQ59g0kspz3bl7 for ; Sat, 18 Jun 2022 16:10:07 +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=fZqfk Q6nMqZ+XNOx3ols19yCmb0V1DuDOmxfZXOmwfo=; b=BDwaWrtJfj5EhZlQAA/Jy segFSLTbJ8wSH5LEEzprTkOmmHqXpz5BrUVM5T009iytcFSwlFsJJ5689E2lj+lw fNfhqlldlwALEDQRYLLGqWs+5HyZOingZ/UbS6cPaGalnVHvg2CkZpuGTeS/LQw9 /oAWTdGk2HFVXrV1Z86SQU= Received: from localhost.localdomain (unknown [124.16.139.61]) by smtp2 (Coremail) with SMTP id DMmowAC3wgXza61iZ1BsDg--.24049S2; Sat, 18 Jun 2022 14:08:52 +0800 (CST) From: Liang He To: timur@kernel.org, gregkh@linuxfoundation.org, jirislaby@kernel.org Subject: [PATCH] tty: serial: Fix refcount leak bug in ucc_uart.c Date: Sat, 18 Jun 2022 14:08:50 +0800 Message-Id: <20220618060850.4058525-1-windhl@126.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-CM-TRANSID: DMmowAC3wgXza61iZ1BsDg--.24049S2 X-Coremail-Antispam: 1Uf129KBjvdXoWrtF4UXry8JryrKry3tw4kXrb_yoW3urX_CF 97WwnrCr1UZF40gFZxZryY9ayav34UuF48u3Z7t3s5XrW5ZF4rXFyqvr97Wr9rC3yjyF9x Crn7Wry0kr4v9jkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7xRMFAp7UUUUU== X-Originating-IP: [124.16.139.61] X-CM-SenderInfo: hzlqvxbo6rjloofrz/1tbi3AQkF1pEDvpQjQABsd 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: , Cc: linuxppc-dev@lists.ozlabs.org, windhl@126.com, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org Errors-To: linuxppc-dev-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" In soc_info(), of_find_node_by_type() will return a node pointer with refcount incremented. We should use of_node_put() when it is not used anymore. Signed-off-by: Liang He Acked-by: Timur Tabi --- drivers/tty/serial/ucc_uart.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/tty/serial/ucc_uart.c b/drivers/tty/serial/ucc_uart.c index 6000853973c1..3cc9ef08455c 100644 --- a/drivers/tty/serial/ucc_uart.c +++ b/drivers/tty/serial/ucc_uart.c @@ -1137,6 +1137,8 @@ static unsigned int soc_info(unsigned int *rev_h, unsigned int *rev_l) /* No compatible property, so try the name. */ soc_string = np->name; + of_node_put(np); + /* Extract the SOC number from the "PowerPC," string */ if ((sscanf(soc_string, "PowerPC,%u", &soc) != 1) || !soc) return 0;