Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3412816rwa; Tue, 23 Aug 2022 04:29:04 -0700 (PDT) X-Google-Smtp-Source: AA6agR7b2vvGY9a5GQ73m2FrE31n5D7x5/l0ntSrhdY2gLtQ2guUVSwDnWgWLu3+vL7ldvH5jMMk X-Received: by 2002:a63:f446:0:b0:42a:a729:18f0 with SMTP id p6-20020a63f446000000b0042aa72918f0mr8179384pgk.589.1661254144272; Tue, 23 Aug 2022 04:29:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661254144; cv=none; d=google.com; s=arc-20160816; b=sPORJbLmi00TPndJj+UiownDI8VZhW647MqpvFz1kLLfjBfBj2F/qE+VRTdOnmf1Fj hdKIgf8anR4NZPvjH+R1NN85SIGYqqwH7Y9KBKahr7M8Mb5AtXq2ME/JQMcwg9zDshDU v6ouH70GxeSmCkTUl+D0F5AfCEloY32fP75cXCqvlyhgnmdg7SXjT636kvTXJ7KkqF2R CdtgUjpl0D7ARn7as0v78EN+5YHZdHZqy0lyG+4x7JSGw/TP2NEyGJFwGMhqtvXu+j3t zt82tBO8HiR4BojDTb3eGG5r5Jsev6pLylNlJ5B7GYE9R0/xJTkLuo6Vf6ogOqWP3wdY QsqA== 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=lB1FKb1AxJ8oQfUce0dsAg+npj2qVQYnAZJ/j1R/VUg=; b=bJuPf5ukriEeJawkCP7rX1wna/VOzjsbhqeG0w3UQI/YLs8+0xSfYKvittXCuz8rVe A6+LUOlx74AbomkVMNRQ36CCIhtCif4cWsf1tQBT7qLHbTsHZFSCq4IaGEPRT8G21LGH VzVHPfqJnplISkBzQfk/Z99i1V5ClKuMq89OEgxGFpVdTAivjUfdTpQc/nfAIhrXi7Cm 0mtnBGnn4xObi1KQ4vVIPURoSktcoVSjFR3xFtGiA186M8mo3a7XJ5/IUwkGXJUGz2aA 4A4B6/wJAHf6x0efzqLMXl5i7NwgJqxCJdrkpvXg184DB2O6WwHDY51oTGiATBTMLDLh J7EQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0kkAjwIF; 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 u184-20020a6385c1000000b0042994899dd6si14933697pgd.470.2022.08.23.04.28.53; Tue, 23 Aug 2022 04:29:04 -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=0kkAjwIF; 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 S1354601AbiHWKZ6 (ORCPT + 99 others); Tue, 23 Aug 2022 06:25:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353642AbiHWKLr (ORCPT ); Tue, 23 Aug 2022 06:11:47 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16FF37F13A; Tue, 23 Aug 2022 01:58:00 -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 2FB8EB81C35; Tue, 23 Aug 2022 08:57:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 78C14C433C1; Tue, 23 Aug 2022 08:57:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661245077; bh=wL+I1X6OYqaa+s1yOlsuInujXPWsQqoekriR1F0yces=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0kkAjwIFef/4m4QCnn0k/VHQVm3jNLAo1I49ALpQhyFiGy5l82r6/NLIOAqq9VKdF hxrw7pyBueKk1UGjzb3mVqvezg9wRu91cs3SfAvfqDUUHTuhyxOH4VplKSIHmGICxL 3VwU1KDKqrCKqAYi4r46gnXbv4RKxB/Uq8EcsaaA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Timur Tabi , Liang He , Sasha Levin Subject: [PATCH 5.15 207/244] tty: serial: Fix refcount leak bug in ucc_uart.c Date: Tue, 23 Aug 2022 10:26:06 +0200 Message-Id: <20220823080106.412901268@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080059.091088642@linuxfoundation.org> References: <20220823080059.091088642@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 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,T_SCC_BODY_TEXT_LINE 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 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 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; -- 2.35.1