From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5DBE434DCF3 for ; Mon, 20 Jul 2026 14:21:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784557262; cv=none; b=oUfCpc1vmLFyKeBVd/CrrLaR3ErXR0ri33l36fKlzTyHFoBm+RHm7Z0DnV/EmuQimsna7/LbRnjftu78OZihOx+aHzV+5fc+RpVayWDH8RiinTGEWITebjWiI7PzYijvaBHNnlC3Kaf0xqNBClERK4NsqUcdB/u+6hRTALT3EyA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784557262; c=relaxed/simple; bh=mUralOzeJlFdPOjwyOQ1cXXEBwjFNAtTps/9kiXPwao=; h=Subject:To:Cc:From:Date:Message-ID:MIME-Version:Content-Type; b=J9ov6gdRhF9frQJ509JYaGZgY/HBInvSdkZuI8DWyuM41IsoiQcv7t4B7JGNEVfReBHGr7SGOU9N9VOTNdVeIwwWEWLLWr4mGnK6NR4Bv8Ts1c0N7hOrD/ztlTqt4/NScHETdfXfz3sG1MF6zj1Glean3idevZRsdKmvqvY6CPk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=N9okPCeM; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="N9okPCeM" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9BE3E1F000E9; Mon, 20 Jul 2026 14:21:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784557261; bh=yhtSKzG7bY7Gnbr6q71eF9JyHoEYMKo6OttOi1EqBvY=; h=Subject:To:Cc:From:Date; b=N9okPCeMx1j3W0Ld5iwu9L4zYBDfF6GOpqcSDBOO4nAYyLRd9QKEtaLd0bdtw0Sq8 bbqifvrhk/kJDjoX2fOO3YLo6fiMu2PwaoeROFFDkASAf+4Ki77Eg6uevbdoWSwa7B r9i9ZsavpER8r88PeiPPUHYusnsilGzw6APCI9W8= Subject: FAILED: patch "[PATCH] remoteproc: qcom: Fix leak when custom dump_segments addition" failed to apply to 6.1-stable tree To: wasim.nazir@oss.qualcomm.com,andersson@kernel.org,mukesh.ojha@oss.qualcomm.com Cc: From: Date: Mon, 20 Jul 2026 16:20:52 +0200 Message-ID: <2026072052-revenge-discount-456e@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit The patch below does not apply to the 6.1-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.1.y git checkout FETCH_HEAD git cherry-pick -x ecf9fc18e62c58eae1ceb65dab2bccb8a724de2d # git commit -s git send-email --to '' --in-reply-to '2026072052-revenge-discount-456e@gregkh' --subject-prefix 'PATCH 6.1.y' 'HEAD^..' Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From ecf9fc18e62c58eae1ceb65dab2bccb8a724de2d Mon Sep 17 00:00:00 2001 From: Wasim Nazir Date: Wed, 18 Mar 2026 17:19:16 +0530 Subject: [PATCH] remoteproc: qcom: Fix leak when custom dump_segments addition fails Free allocated minidump_region 'name' in qcom_add_minidump_segments() when failing before adding the region to 'dump_segments'. Otherwise, the 'name' is not tracked and is never freed by qcom_minidump_cleanup(). Return error when adding to 'dump_segments' fails. Cc: stable@vger.kernel.org # v5.11 Fixes: 8ed8485c4f05 ("remoteproc: qcom: Add capability to collect minidumps") Reviewed-by: Mukesh Ojha Signed-off-by: Wasim Nazir Link: https://lore.kernel.org/r/20260318-rproc-memleak-v2-1-ade70ab858f2@oss.qualcomm.com Signed-off-by: Bjorn Andersson diff --git a/drivers/remoteproc/qcom_common.c b/drivers/remoteproc/qcom_common.c index fd2b6824ad26..e1a955476c9b 100644 --- a/drivers/remoteproc/qcom_common.c +++ b/drivers/remoteproc/qcom_common.c @@ -109,6 +109,7 @@ static int qcom_add_minidump_segments(struct rproc *rproc, struct minidump_subsy struct minidump_region __iomem *ptr; struct minidump_region region; int seg_cnt, i; + int ret = 0; dma_addr_t da; size_t size; char *name; @@ -129,17 +130,22 @@ static int qcom_add_minidump_segments(struct rproc *rproc, struct minidump_subsy if (le32_to_cpu(region.valid) == MINIDUMP_REGION_VALID) { name = kstrndup(region.name, MAX_REGION_NAME_LENGTH - 1, GFP_KERNEL); if (!name) { - iounmap(ptr); - return -ENOMEM; + ret = -ENOMEM; + break; } da = le64_to_cpu(region.address); size = le64_to_cpu(region.size); - rproc_coredump_add_custom_segment(rproc, da, size, rproc_dumpfn_t, name); + ret = rproc_coredump_add_custom_segment(rproc, da, size, rproc_dumpfn_t, + name); + if (ret) { + kfree(name); + break; + } } } iounmap(ptr); - return 0; + return ret; } void qcom_minidump(struct rproc *rproc, unsigned int minidump_id,