Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2926957rwb; Mon, 15 Aug 2022 14:12:22 -0700 (PDT) X-Google-Smtp-Source: AA6agR6BwQWwrd1GGDJSHwNr5R4/Q1MdTJW3Lo2uDhvNWdToFmZ5SspHuOppnxB1tvcE8FgYkxiR X-Received: by 2002:a17:90b:4c12:b0:1f5:958:c313 with SMTP id na18-20020a17090b4c1200b001f50958c313mr30110350pjb.6.1660597941886; Mon, 15 Aug 2022 14:12:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660597941; cv=none; d=google.com; s=arc-20160816; b=Gwdy5x84wAKU3WhYI3UjPJnKrXk9o6kcp+oSMYIupLHCo0vCulgJE8RSzs8acH2Tjk g6eBZa+Gv1JOs8MXyZsme4p71IwVUlUeza0a4mNHVro3IUsK8zBN1+7kZLeIc0x9Byb4 XDAcwxxJUihT4rjRMvh2cywcBHXo10RZY1705aAvVaBiKO69filGNLG0sKZfwtmZjMt5 Rf3zoiSZJkuiyeEUT+9WSaNiteiYFlfOuwpcO1PZpx1Z6qn4Y1eZ2MtaWTXI2bQmmhj9 rUpvdpp2o7o55+5xDXSEy/EnaUAmvQsLhUTivL004+kKF7uUiWu1L6Xv54LEIvUl6KIy +KCg== 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=69TylvRDyoFx7vLW5pHp9MjvDeBjWuSo0PTUgrjMzFI=; b=Ns76hGj8kLyZErPwtHUYCbdg5GezSfzxVZXdjbt5yjX1TAjy7pbYa9uftkWXBd2EWk 1c1H64ia+cKM1lrLRMdRX+uo8DsNTtmPE/Bd1/OdQjf+ce1SHf3TmVWXjZl7QEfixsKc HbYHI17KV3i0DLR+eM5z+uwSSP45r15Aduenhz/+CdpK2PZiI0QXEU7IjH0P/ARWux8Y BiK3byYGVNRTYPm76v2wHhY5tZZ9nVAu3ygHu0AoQDJPUh7Hr8JbC+9KvMiF6yCa0JGD w0gh/lnzwA22+SIiFlzhI1jyTUgnvYEsuHk0p4qNDNF/fPZSeRFYpGMaqjBF6h4RhylS zW7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=L5nHUFxI; 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 d9-20020a170902e14900b001712d2bd530si9852736pla.178.2022.08.15.14.12.10; Mon, 15 Aug 2022 14:12:21 -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=L5nHUFxI; 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 S245449AbiHOTXR (ORCPT + 99 others); Mon, 15 Aug 2022 15:23:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344221AbiHOTUq (ORCPT ); Mon, 15 Aug 2022 15:20:46 -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 D051759264; Mon, 15 Aug 2022 11:40:03 -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 EF3E9B81085; Mon, 15 Aug 2022 18:40:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2EAEAC433C1; Mon, 15 Aug 2022 18:39:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588800; bh=O4SfQ5D1AyxFTpjpSClFOyGOYUOzakR3Z6tmmpcgcDA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L5nHUFxIGKThQNMn4Fdn1twwlH0yeNhOFoeMqQ6pqf3GVxgEjYSFQvFnEJy7uXhbB jJRgTmO0DLd8rRRh6ntxxE9XwzIJtukaDFppT5gKjwtrbylWmZLcCJVmBiEFyEzr9O KsTYTflxyrdOTjK/Axq29ctq8xNH/i96ciOE+x+8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Sasha Levin Subject: [PATCH 5.15 491/779] usb: aspeed-vhub: Fix refcount leak bug in ast_vhub_init_desc() Date: Mon, 15 Aug 2022 20:02:15 +0200 Message-Id: <20220815180358.252561345@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@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 220fafb4ed04187e9c17be4152da5a7f2ffbdd8c ] We should call of_node_put() for the reference returned by of_get_child_by_name() which has increased the refcount. Fixes: 30d2617fd7ed ("usb: gadget: aspeed: allow to set usb strings in device tree") Signed-off-by: Liang He Link: https://lore.kernel.org/r/20220713120528.368168-1-windhl@126.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/gadget/udc/aspeed-vhub/hub.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/usb/gadget/udc/aspeed-vhub/hub.c b/drivers/usb/gadget/udc/aspeed-vhub/hub.c index b9960fdd8a51..16a12d2d492e 100644 --- a/drivers/usb/gadget/udc/aspeed-vhub/hub.c +++ b/drivers/usb/gadget/udc/aspeed-vhub/hub.c @@ -1028,8 +1028,10 @@ static int ast_vhub_init_desc(struct ast_vhub *vhub) /* Initialize vhub String Descriptors. */ INIT_LIST_HEAD(&vhub->vhub_str_desc); desc_np = of_get_child_by_name(vhub_np, "vhub-strings"); - if (desc_np) + if (desc_np) { ret = ast_vhub_of_parse_str_desc(vhub, desc_np); + of_node_put(desc_np); + } else ret = ast_vhub_str_alloc_add(vhub, &ast_vhub_strings); -- 2.35.1