Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3325642rwa; Tue, 23 Aug 2022 02:53:45 -0700 (PDT) X-Google-Smtp-Source: AA6agR5QXGBsfeI13pEfHTrj/s0iEVsyj+CHn5g9ALhix6yWPCQM8spMZhuD8t+WQJL/T+UFpvNt X-Received: by 2002:a05:6402:1f87:b0:43b:b88d:1d93 with SMTP id c7-20020a0564021f8700b0043bb88d1d93mr2955766edc.314.1661248424941; Tue, 23 Aug 2022 02:53:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661248424; cv=none; d=google.com; s=arc-20160816; b=aH27wjQbfxN1r0jgZkSy2ILd8U5D3vPwBxL/Ej6oyb2KQ24rHrFmlWrePI1kO+0Bvl NlCFu+ry2WQKkg0bsOL1M9wFYUEspk8s/N++KQ9/kTrObDjVEZhfEaTr+USfabN+olYr /IG4yyAPerCjZh/Nr41wEk6dRyi4l8nKMvQ0BC9W6+StVRiHVnDsGBv/kDw8E2uqpr4E J8l1aD6WcZkkNgY4C0bkhoGh6IAdc1A3yCz2mRLPII3XMaICwYR+i+KL9lRExNLW3s8G gknuuMDIk4iK3z+iS2Mk8WJ3zi/hoG/kLs6JZn2x5ygi8vhuSygKtnuJhieyuQ6QChEz 4szg== 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=rxFt6KvQXLZAsjMRMj17236zt28fAdPw18SWTWVIBtF+GMR47H2SuWySnF5pACU8AZ S8vqy50nB3l+c2u2MxIxsz32EmfklGcsGX0/a4wu3sJ/Ezp5jncpms0G3LiVQcSks9/1 0V2l8HQKjuEPiCLCbVjzs7gkzU47hbri6iA+v6VGoXxyiSQbCC+LqUy9IwvANGbGdzXL BteffpEKu1Z09eorbVY1DBeS5UyLQzAdbDrelokj8rvJiZ/4DUs1AIHnxQH1OAhEwUzl ToDydRFmWwAuYMlOT8Ro55Vo6v4qqOshRXafLT7URHi7NKWkuiMaBLI6pZuOEIL0ZBb9 l5vg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=asnP2eya; 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 hb7-20020a170907160700b00731010c202dsi10956217ejc.764.2022.08.23.02.53.19; Tue, 23 Aug 2022 02:53:44 -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=asnP2eya; 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 S1348261AbiHWJWS (ORCPT + 99 others); Tue, 23 Aug 2022 05:22:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37620 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349050AbiHWJUM (ORCPT ); Tue, 23 Aug 2022 05:20:12 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C8E448C8A; Tue, 23 Aug 2022 01:33:52 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 7CCDB614E1; Tue, 23 Aug 2022 08:32:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 873F8C433C1; Tue, 23 Aug 2022 08:32:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243575; bh=wL+I1X6OYqaa+s1yOlsuInujXPWsQqoekriR1F0yces=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=asnP2eyaKWmf5kn84AMsHVpGTPMQKaZ6oxHiUBZ7rhUGdieNUsL6eF9dMwwBVbY/t rGBPWud6hY8DNxLS+YA4m0406m/fC7XlKOYbD7v+4a/NfwCtfQfI04O3y02UMu0u6Q QeVU7u2b+yLc5BdCgMarXvymISHGfH4SNS+HNjyk= 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.19 320/365] tty: serial: Fix refcount leak bug in ucc_uart.c Date: Tue, 23 Aug 2022 10:03:41 +0200 Message-Id: <20220823080131.574400568@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@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