From patchwork Tue Jan 9 11:33:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bethany Jamison X-Patchwork-Id: 1884391 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=185.125.189.65; helo=lists.ubuntu.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=patchwork.ozlabs.org) Received: from lists.ubuntu.com (lists.ubuntu.com [185.125.189.65]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4T8TNH6Jrcz1yP3 for ; Tue, 9 Jan 2024 22:34:07 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=lists.ubuntu.com) by lists.ubuntu.com with esmtp (Exim 4.86_2) (envelope-from ) id 1rNAMo-0000bw-Td; Tue, 09 Jan 2024 11:33:58 +0000 Received: from smtp-relay-internal-1.internal ([10.131.114.114] helo=smtp-relay-internal-1.canonical.com) by lists.ubuntu.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1rNAMj-0000at-9E for kernel-team@lists.ubuntu.com; Tue, 09 Jan 2024 11:33:53 +0000 Received: from mail-vs1-f69.google.com (mail-vs1-f69.google.com [209.85.217.69]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id EF4E43F2C4 for ; Tue, 9 Jan 2024 11:33:52 +0000 (UTC) Received: by mail-vs1-f69.google.com with SMTP id ada2fe7eead31-466eef433c1so483378137.0 for ; Tue, 09 Jan 2024 03:33:52 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704800031; x=1705404831; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lYjwLnXLtjaAw6ye55HRXA7o4FKMjgL/06sxXYrjy1U=; b=U8ycgAbH6mwlqHYnHqa1sFBUwZqZnjEUDvsuHScyefeuwH6GaF/z64KTJkYOIe4kcx rIr4OLv4oD0xp8RRv8LmWL2rrOqhSRJ9R5/NYfgeVorKb+nZ076dxbl08s1jJFVW1VrL hchYWeiUx1nah0/SNTGZ9sHNB8loWaDr3T0wEPTcVi91oPcoaSbp9PXNfq8LWSa1p8ek 14Ti73MGiO8D/1njuFDxCEW+5hDwG8vck4URZraD+OJnGFbWMHZrTeV6qShJ//339RI2 ybNYsFnj2uXsNO/6bDWiuyTgEIh/Kbl48h7wU5gK/B9U+d6QlJYDMpZ8t8YRNVcGTFgb Zc9A== X-Gm-Message-State: AOJu0Yx+dsrU5LGBzTc+5F3qB4qCe6+BT+Rjpveith5b/D/EVHnWPrrE kd3EAZ31/18jklLkc5fTL2VUOAiOjRxzrXrn89EqXdJDMr0kN3F2VPKik/PT7FLPrps+1Mj1xEK 1KLHXShDn6Yqbx/4Qd+ZFKwr5HDWmhNRwehBt2hN4Xfo6+8xAjqBUtb0D X-Received: by 2002:a05:6102:38c8:b0:467:ec87:c7f7 with SMTP id k8-20020a05610238c800b00467ec87c7f7mr170193vst.4.1704800031607; Tue, 09 Jan 2024 03:33:51 -0800 (PST) X-Google-Smtp-Source: AGHT+IFNrD/lx0LmJZXQkPrH4mnWi6N+SdA1LS5x7cuUu/FHxwGNbWPnxgyyRlBJelLCopnvU4sCoQ== X-Received: by 2002:a05:6102:38c8:b0:467:ec87:c7f7 with SMTP id k8-20020a05610238c800b00467ec87c7f7mr170192vst.4.1704800031355; Tue, 09 Jan 2024 03:33:51 -0800 (PST) Received: from smtp.gmail.com (184-091-006-043.res.spectrum.com. [184.91.6.43]) by smtp.gmail.com with ESMTPSA id hx6-20020a67e786000000b00467be2e0fa1sm261089vsb.25.2024.01.09.03.33.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jan 2024 03:33:51 -0800 (PST) From: Bethany Jamison To: kernel-team@lists.ubuntu.com Subject: [SRU][Focal][PATCH 1/1] usb: dwc3: dwc3-qcom: Add missing platform_device_put() in dwc3_qcom_acpi_register_core Date: Tue, 9 Jan 2024 06:33:48 -0500 Message-Id: <20240109113349.6985-2-bethany.jamison@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240109113349.6985-1-bethany.jamison@canonical.com> References: <20240109113349.6985-1-bethany.jamison@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Miaoqian Lin Add the missing platform_device_put() before return from dwc3_qcom_acpi_register_core in the error handling case. Signed-off-by: Miaoqian Lin Link: https://lore.kernel.org/r/20211231113641.31474-1-linmq006@gmail.com Signed-off-by: Greg Kroah-Hartman (cherry picked from commit fa0ef93868a6062babe1144df2807a8b1d4924d2) CVE-2023-22995 Signed-off-by: Bethany Jamison --- drivers/usb/dwc3/dwc3-qcom.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c index 8c3ab9bfbb9e..fc3b698d81c0 100644 --- a/drivers/usb/dwc3/dwc3-qcom.c +++ b/drivers/usb/dwc3/dwc3-qcom.c @@ -489,8 +489,10 @@ static int dwc3_qcom_acpi_register_core(struct platform_device *pdev) qcom->dwc3->dev.coherent_dma_mask = dev->coherent_dma_mask; child_res = kcalloc(2, sizeof(*child_res), GFP_KERNEL); - if (!child_res) + if (!child_res) { + platform_device_put(qcom->dwc3); return -ENOMEM; + } res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!res) { @@ -522,10 +524,15 @@ static int dwc3_qcom_acpi_register_core(struct platform_device *pdev) } ret = platform_device_add(qcom->dwc3); - if (ret) + if (ret) { dev_err(&pdev->dev, "failed to add device\n"); + goto out; + } + kfree(child_res); + return 0; out: + platform_device_put(qcom->dwc3); kfree(child_res); return ret; }