From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 90F5EC25B0E for ; Sun, 14 Aug 2022 16:42:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243326AbiHNQks (ORCPT ); Sun, 14 Aug 2022 12:40:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243125AbiHNQjy (ORCPT ); Sun, 14 Aug 2022 12:39:54 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 383DFC79; Sun, 14 Aug 2022 09:30:05 -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 D20F9B80AEE; Sun, 14 Aug 2022 16:30:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AAA28C433D7; Sun, 14 Aug 2022 16:30:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1660494602; bh=TcBl72HrHmjDRathhtjfFih6aIlKLd2vED0J2ncQORk=; h=From:To:Cc:Subject:Date:From; b=FDJT1EfQ1erLqnoybCmsCInf0WQptADAtvuPouPxmse7ozv8MPclnD/0ANovjpB9G m2Ym0hRLFboLdkNWWyZjNG2H3vKKgAhJo1WWXDTFVmEegRjGkaYUv1Dqq0GsaYxFX+ AsXHQxwAEgcik/Y4Haqa2AQk+JopFU3A3uED3ksY/Nlcdv6TvC9eiwCE5BLlbVpk1+ NPP2L8NGJftnjzo5cd3HuoKogzJD2bRKgQq7zbKpBAGc6m7KLr3Ddmv+PLXHxaTYok DpV4iTWAR0bdWrhv4b6pSUXBvTFqHXBkmQUZ7XAHraYjMc7A9vE2B8gZbOV7LOzbZ+ 6zssGA+RI71XQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Liang He , Timur Tabi , Greg Kroah-Hartman , Sasha Levin , jirislaby@kernel.org, linuxppc-dev@lists.ozlabs.org, linux-serial@vger.kernel.org Subject: [PATCH AUTOSEL 4.14 1/9] tty: serial: Fix refcount leak bug in ucc_uart.c Date: Sun, 14 Aug 2022 12:29:51 -0400 Message-Id: <20220814162959.2399011-1-sashal@kernel.org> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Liang He [ Upstream commit d24d7bb2cd947676f9b71fb944d045e09b8b282f ] 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. Acked-by: Timur Tabi Signed-off-by: Liang He Link: https://lore.kernel.org/r/20220618060850.4058525-1-windhl@126.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- 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 55b702775786..40b8e414f48f 100644 --- a/drivers/tty/serial/ucc_uart.c +++ b/drivers/tty/serial/ucc_uart.c @@ -1143,6 +1143,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; -- 2.35.1