Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3355229rwa; Tue, 23 Aug 2022 03:27:33 -0700 (PDT) X-Google-Smtp-Source: AA6agR6gsRKZ65z2bxDigwqS5R5hypr2VaoPPWR9bS/Pk30Df5VtSTnfj5vhdPCf6lqTdnBMyOOn X-Received: by 2002:a17:907:2e01:b0:731:1eb0:b9ff with SMTP id ig1-20020a1709072e0100b007311eb0b9ffmr16148125ejc.728.1661250453686; Tue, 23 Aug 2022 03:27:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661250453; cv=none; d=google.com; s=arc-20160816; b=na9DZSv/LKflJziYS+7FddBDUDqavwvxYz7SIjLqst2LJBHQFXfcWGRztbFFI9goxm 3qa3PRFrQBgBzlD6TaqrijtSQFUdv+Nw6KMQqCvcbbOBPPfAGD4LyZCB5HcBQ4cjmZFo WVE+hzH7COQKBNw7+7YV++EAptvWK4kW4PsJ/3w83N6pUAS5d4lS3I9IfEHGgbOfr9du DtA7ntB3iwQLSqzqoAsz9WRvpPAUwjYIT/BHrGHQKG5WnyG8uPPE6aY0OGCQ3Bc1iOBR qNaJVPXnb82cZXWlCRTLgydu7dNaIaFET3RmBIZjJcbkA39Na8UX2QDmER7D2Rk/YGpF JlSg== 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=q+A2O9LKjAreKYlgGUpuTMfKjPqBCSAddRU4p7IiykE=; b=rFqKgv/MZMlg5xJBCalODfiVOK1DQIJi6lVn3bm8O4FL/1nNVMGbnyWsjkWM8sE/gd yb7C4abP15dvL2cFFHPKwrmjsgUOWtx5kt3nXihtnke9RUNUjZ67ZAWw6gXnzM+2OBA7 J0GEUWSOl/wLVTCzytdJGP+U8gVmr2S48PXbPnhhbJFDaWcETUdbj9FM5WhMrMereRDi jGEHpaHBSSvuU4i5y8ejDUBhViyN8LxnE0++90s9V5wXIWqcilfGTD85arVs30+uNout 63HwW3ffZhO11oQ+uvdXAFyqQGPA6nsQgZio6SyXNh6Y1flXXwSgyJvnG9hHswp+CL/p XMvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WXSoR1m5; 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 cf20-20020a170906b2d400b0072f1c8d0e62si9483593ejb.95.2022.08.23.03.27.03; Tue, 23 Aug 2022 03:27:33 -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=WXSoR1m5; 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 S1352886AbiHWKXl (ORCPT + 99 others); Tue, 23 Aug 2022 06:23:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353479AbiHWKLd (ORCPT ); Tue, 23 Aug 2022 06:11:33 -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 1AEFB7F111; Tue, 23 Aug 2022 01:56:57 -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 D2756B81C28; Tue, 23 Aug 2022 08:56:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3B762C433C1; Tue, 23 Aug 2022 08:56:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661245014; bh=TcBl72HrHmjDRathhtjfFih6aIlKLd2vED0J2ncQORk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WXSoR1m5wYZQB2Rf4Scl0MI3NhH21bH+oDjqn4R/gwjPtgKMXzFMwkPwVNGHZOf6Z 4qt7EHItRVL0nDE25MLCAmPJoUA6YTyIg/LDSfkFdQQErL8ymXEthi/4l8S7Hb+mPi h8UDcOrL9KEim3EeIyyX4wMgMesVaJ9M7ACTb09Q= 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.14 221/229] tty: serial: Fix refcount leak bug in ucc_uart.c Date: Tue, 23 Aug 2022 10:26:22 +0200 Message-Id: <20220823080101.530122222@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080053.202747790@linuxfoundation.org> References: <20220823080053.202747790@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 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