Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3416574rwa; Tue, 23 Aug 2022 04:32:42 -0700 (PDT) X-Google-Smtp-Source: AA6agR4UtqxmjYnFmpX2yAkabm2GQL4PAnFu9fvnCjyniGYXXFEisQ/HnwTrTZQIOhJveGkFU826 X-Received: by 2002:a17:907:60c7:b0:731:148b:c515 with SMTP id hv7-20020a17090760c700b00731148bc515mr16231650ejc.724.1661254245699; Tue, 23 Aug 2022 04:30:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661254245; cv=none; d=google.com; s=arc-20160816; b=VVRD0NdHMXWmay8rrnqJIscq9Lbdm7gh+RRkY1dRPU+Qv02W++Dud6rTqA3UWMhmii m1Nh9rTbeRSMA1a/bGRPebP1GbjpWoDQpYM6TNBBd0/Val/rZOMh8pJL4ZZ2nq4hSK8o F3Kqkk1uS0ATjYw3aauDyQpjIdYJeXax33DAVOdrFOqfxTLcupNuG/MCHunbleinWOlI 6FO2aqBwMp6xwTg7JF2/IiImQi9cWQP610pvvIWnFtOt4rQi4Wf4x0jZVlYq1jGAzTTn DeTycE4cNso4XUx2yx2a83I7oWBKfW/bBrRHZJEXWBV605Rh3ntphE7vWEZPZ/k9t66R EAyA== 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=TdD5KmUzCyHsjvQ3+iSDCKmqNh8stDhx1yej+cm2NqU=; b=tG/GCBk0oeFyDc0EJy5dXDU10Nd7kV7ZUIj+AgrWNs1X3z1p1tmedHouUbsoo0rGGm cT6Nr2FpUQGjNOGa9pf0ZbRz1hMQxRMrj93U2PY6waqA4USXq6rY0CdCteZmhUu25TXI zRoHbQO1kHSzBPpheQy6o2/T74ac0hZxjO2Jq0953om3+/HNW0J3LwBITRogedA0+Hwd Tx78mpplawFXfSG+eWNUXubGByOlqTqsDB7MocBtK0ZtMNT2zFNmN9BTOu3oqHvcKiXI nkRuaolXGPancH1v+kuC+qgP7gXYloBGX/FMnwCTr3o5U9v3WO2gzfK/mZEmnE7otiwL u6Yw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=TOqscjuY; 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 s12-20020a1709064d8c00b0073d7097ac8asi5814879eju.538.2022.08.23.04.30.20; Tue, 23 Aug 2022 04:30:45 -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=TOqscjuY; 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 S1357142AbiHWLIj (ORCPT + 99 others); Tue, 23 Aug 2022 07:08:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357286AbiHWLGa (ORCPT ); Tue, 23 Aug 2022 07:06:30 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D8C8B515D; Tue, 23 Aug 2022 02:16:04 -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 sin.source.kernel.org (Postfix) with ESMTPS id ADB1FCE1B5D; Tue, 23 Aug 2022 09:15:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C27ADC433C1; Tue, 23 Aug 2022 09:15:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661246120; bh=SjU1n1ytovhL3UgKE8PCRmwFhJUvTy4uztS1wVLyviQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TOqscjuYHs7HJAtwsb1zK9xBcOhsFVlLD8LxV8grjvdF+agy6c9LDyiZmX2dvImmO L44dN0O2EEaLr75TkUSW1eUBKdrdabdMTVtQJstCcFAurJf5b4691R94HSkyLhUPxm MWo8bXUBsvTSPpPT/4q6Yb1VoVBoYKkjbiA75MAI= 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 4.19 271/287] tty: serial: Fix refcount leak bug in ucc_uart.c Date: Tue, 23 Aug 2022 10:27:20 +0200 Message-Id: <20220823080110.501223816@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080100.268827165@linuxfoundation.org> References: <20220823080100.268827165@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 2b6376e6e5ad..eb0d3f55235a 100644 --- a/drivers/tty/serial/ucc_uart.c +++ b/drivers/tty/serial/ucc_uart.c @@ -1141,6 +1141,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