Received: by 2002:a05:7412:518d:b0:e2:908c:2ebd with SMTP id fn13csp348005rdb; Thu, 5 Oct 2023 07:43:15 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEquIG+mbkhcapxtRunsM74ASwNqb8dypujGlWWRqlntGdM22TGPxAUeZ0bi/b2JivPCj82 X-Received: by 2002:a05:6358:94a0:b0:141:162:b0cd with SMTP id i32-20020a05635894a000b001410162b0cdmr5632909rwb.19.1696516995570; Thu, 05 Oct 2023 07:43:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696516995; cv=none; d=google.com; s=arc-20160816; b=ABLcmPsYlkVAw/QQjVFCQzYSLk+BbLtsVFakIrwiKP4WyCcJE6AMhd6VhYOZMopbOt 7rB8RE6xOoGY2+1zw8ELEAofkv8uXYUP9sEwymewwbKwx3hJiAMKCtuT4z3EaslSSRGm GlLncIl8qadtbdThNZwHHTUc76JRLYP81zHVg7D1tx6WcFIGLAvrM2hpHMh+19Atp4e1 d5FBtUuQRarL/pt6OoRNUQ8Fuaatd1zhsaIXCsUPbQ7n+RBsnrT3eTJTetXXwbft0BLN tRa8dEyPihtFuFzcwwY9c3CmXFTK4XCECw4Y0Z9XxD46H0a0KYOe3FFvCXH9nH2z1p66 +thA== 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:date :subject:cc:to:from:message-id:dkim-signature; bh=SXOUgbldgZBCY3GyES22l+Ixl/lk+hf9+Aq9JS/F44U=; fh=HLTQsco8ZjIeurg0UtFgru8TvRMrAtSXtmWWBeuNXkM=; b=xkhRe/04s+SFPyY8aIPuZUArnoE7NclthH93bGIvn1d1rYy157GfTgzMLlQIe7Krgc wtBD3e6nQFhfZjIPgj3y+hGb6XWrrBmtHKIfyPTSOIwAj47Yq1APBX8C7ysWaRE+JyEd +73Lkbhs1+O0azn4IsXdd6EhZCNxXX8wN6Rh3AzBrdU8/U4Is8LgIEGTCvuxXRBcfCQg 4WJ4t+ihG60RkQfx6kH1hs8uIFeJMmtrHEvg6TzkE49mBFc1gg3ZEWkI4clOzR73/n8s r348ZahxMN27WIyJglzNUoCAxdFYO4xeMhpclKzxbWG2Dkb7BLFEkk6FUCnIHoD0lxhR dl5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@foxmail.com header.s=s201512 header.b=ivbGpObT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foxmail.com Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id q136-20020a632a8e000000b00573f76b1f75si1538198pgq.592.2023.10.05.07.43.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Oct 2023 07:43:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@foxmail.com header.s=s201512 header.b=ivbGpObT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foxmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 8284382F08D2; Thu, 5 Oct 2023 07:43:13 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237035AbjJEOmv (ORCPT + 99 others); Thu, 5 Oct 2023 10:42:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233783AbjJEOiE (ORCPT ); Thu, 5 Oct 2023 10:38:04 -0400 X-Greylist: delayed 435 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Thu, 05 Oct 2023 07:03:36 PDT Received: from out203-205-221-242.mail.qq.com (out203-205-221-242.mail.qq.com [203.205.221.242]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16DA759E6; Thu, 5 Oct 2023 07:03:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1696514613; bh=SXOUgbldgZBCY3GyES22l+Ixl/lk+hf9+Aq9JS/F44U=; h=From:To:Cc:Subject:Date; b=ivbGpObTfpcXyvTA6pLrkKVYM8ddZpZLIkVIaEDUv+4b6FjjRZSAdcNZlsATIjqdk 6UgwiIQRZLoS+Lu5cp3PZht1bRkuAt4lNYy+LyYO4wSX9V9jQElNQgbsJs0vWG8xuq 0JLrHcH9CcmmjICvxGFqeBfA2XjHGiO2+cUGpaKQ= Received: from KernelDevBox.byted.org ([180.184.103.200]) by newxmesmtplogicsvrsza12-0.qq.com (NewEsmtp) with SMTP id C7005A1E; Thu, 05 Oct 2023 21:49:48 +0800 X-QQ-mid: xmsmtpt1696513788t2552ounz Message-ID: X-QQ-XMAILINFO: MILSKRzDrLPb9EuLXmTn57oGreBCkYaFwc9IUcG6/5HF5vHFojYNqHhnEx5ycG J2FoBqQxKuVm8bD5TlMpxToHTmBj3N0FQjHU/8vHoMtdHdOSLuixdQxVWyJ+QASvQbAEIbkvO4/j r8H3zEEUWGT6D2p5kIYAN+HnOUEi1LVD/hskoQvnIELONuoJpgGFylV/wLa6XQMUe6u3F4lSZ+LJ uk/Jv0sSJcmkNQ+u4ZsTsIVepEX1QcdbUJWKulmeY9O3p5u9rbe1lk+MICpeZJqVctfi5IwnXjTh FBJe3AqbZD7cyQ5M2BE+4mq8nDiRwGgxjPbCAQkzVQ6PkeyrvzTr2UkB8i0pE4A40r07HvrRVm6r 4rIvBSBj7OsXv+n7vei0du/773JvOUm4G+SRKlU6CMP7XZykKFlKkSnAcqF0sva20v+0+LhEEj8N s6kNU+GmOSEYFh8E+O/d9Y3dOF7J4WbU19Zn0kFPPGUpi9vWwmMNrYnO04iW/aDXI4FEwEzVHAt4 QekwZSY4LAfLvKyULVuzneot2gOTQE8zqwNMxYyoHN3yC/nl9h6k0XvqAkEPVCYmbvZnRPO9vPhV 7+73//LgD6yaYmcm6MtgAB7nq+E5dUaARkw4ej5nXbT5do34NKD8PLCLT4qIu50k4lPx3Sp+4jGK lkawqTtY9IAlLqSQX7txS6BqP02Cti421bKZ28iJN/4er0xIqJ0QlPhua+ZnJFcx0KYJh+TiblbM cZrOIdNEfj0mpvLx3yfxoMUu2xE4v0caVCFitQb4NJHmgrFqB7L/NKroOdjzAQKvawFmvn3ImT4P q+gd2Gm9MvdrvXW9vEKdJPd97/SC+sDM9Qk/kKORdaKJZmpekb5WRT+r1RoTEbK+intAVmIN22J9 NPyUDx1Sx0HtnWTfKxgReIK610bhXSe6uAZdcG+j4jAUXD0hxifiPyP/yN3HHl4ASwKvF4dseb58 Sn+yaI7fCm9bhDyfGCaD7GMi4qkt/MvwStO0GFPlboTnIWb8l8yznghXiqFvMQHXppFVc2kac= X-QQ-XMRINFO: M/715EihBoGSf6IYSX1iLFg= From: Zhang Shurong To: Thinh.Nguyen@synopsys.com Cc: gregkh@linuxfoundation.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Zhang Shurong Subject: [PATCH] usb: dwc3: fix possible object reference leak Date: Thu, 5 Oct 2023 21:49:46 +0800 X-OQ-MSGID: <20231005134946.2197459-1-zhang_shurong@foxmail.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, HELO_DYNAMIC_IPADDR,RCVD_IN_DNSWL_BLOCKED,RDNS_DYNAMIC,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 05 Oct 2023 07:43:13 -0700 (PDT) The of_find_device_by_node takes a reference to the struct device when find the match device,we should release it when fail. Fix it by calling by calling platform_device_put when error returns. Signed-off-by: Zhang Shurong --- drivers/usb/dwc3/dwc3-imx8mp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/usb/dwc3/dwc3-imx8mp.c b/drivers/usb/dwc3/dwc3-imx8mp.c index a1e15f2fffdb..af5302c3f7a9 100644 --- a/drivers/usb/dwc3/dwc3-imx8mp.c +++ b/drivers/usb/dwc3/dwc3-imx8mp.c @@ -244,7 +244,7 @@ static int dwc3_imx8mp_probe(struct platform_device *pdev) IRQF_ONESHOT, dev_name(dev), dwc3_imx); if (err) { dev_err(dev, "failed to request IRQ #%d --> %d\n", irq, err); - goto depopulate; + goto err_device_put; } device_set_wakeup_capable(dev, true); @@ -252,6 +252,8 @@ static int dwc3_imx8mp_probe(struct platform_device *pdev) return 0; +err_device_put: + platform_device_put(dwc3_imx->dwc3); depopulate: of_platform_depopulate(dev); err_node_put: -- 2.30.2