Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 5E4A8345CC0 for ; Tue, 17 Mar 2026 12:51:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773751914; cv=none; b=BF7kWscqNwDlJ/kWCN60p113PIUk1egpX2NEq+DLI/IEmi3hvnn0BOb4k72fvyW5RI6Rq0WI1Inwzji0KG9Fi4A2jRFTlBFRFV8B3BgTN8qkLLtJkdUOTXmGk1f6GG0uZGeAHD39JfoHD8t3quVv/gOk3vgVgnBN+BR7QYvCeIk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773751914; c=relaxed/simple; bh=crl9sQRvCleGlIp6OcAmMdLtiqJX32ZSZaC4/8EnhNY=; h=Subject:To:Cc:From:Date:Message-ID:MIME-Version:Content-Type; b=hkEBwMUmtC2hlmEAGMhBRAprzpLQrZeN30DbIvqALxkrw2cWhBaH+eLA4LoYBy4zQudmalA2SF9+5N5OjD7bj5X1L8tz6rsdYQvwXk94qx0qDD1Iueq+XRzpUEpJ3VIfaDun4vuNRV2O/NBEaTZItw0nKRSe8jaJizjo8sNiX1k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=iocjZhuG; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="iocjZhuG" Received: by smtp.kernel.org (Postfix) with ESMTPSA id ADBA1C4CEF7; Tue, 17 Mar 2026 12:51:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1773751914; bh=crl9sQRvCleGlIp6OcAmMdLtiqJX32ZSZaC4/8EnhNY=; h=Subject:To:Cc:From:Date:From; b=iocjZhuGkDRhyptbCa/auTiIys3o2m4D3XcUfaqT5vTk/U0YXqj75QXkBmhr4WHgv fqgxN9kTole5jGciPTURd2bNC2HY/TSOcH4imT2m/3uo7Pxo4tH5pGUwCIlvvGINlZ F62bXtBsivZWMFhkJ1kWSaaagwE4veBAfd08Ewyw= Subject: FAILED: patch "[PATCH] drm/xe: Fix memory leak in xe_vm_madvise_ioctl" failed to apply to 6.18-stable tree To: varun.gupta@intel.com,matthew.brost@intel.com,rodrigo.vivi@intel.com,shuicheng.lin@intel.com,tejas.upadhyay@intel.com Cc: From: Date: Tue, 17 Mar 2026 13:51:43 +0100 Message-ID: <2026031743-pamperer-outfit-94e5@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.18-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.18.y git checkout FETCH_HEAD git cherry-pick -x 0cfe9c4838f1147713f6b5c02094cd4dc0c598fa # git commit -s git send-email --to '' --in-reply-to '2026031743-pamperer-outfit-94e5@gregkh' --subject-prefix 'PATCH 6.18.y' HEAD^.. Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ From 0cfe9c4838f1147713f6b5c02094cd4dc0c598fa Mon Sep 17 00:00:00 2001 From: Varun Gupta Date: Mon, 23 Feb 2026 23:21:45 +0530 Subject: [PATCH] drm/xe: Fix memory leak in xe_vm_madvise_ioctl When check_bo_args_are_sane() validation fails, jump to the new free_vmas cleanup label to properly free the allocated resources. This ensures proper cleanup in this error path. Fixes: 293032eec4ba ("drm/xe/bo: Update atomic_access attribute on madvise") Cc: stable@vger.kernel.org # v6.18+ Reviewed-by: Shuicheng Lin Signed-off-by: Varun Gupta Reviewed-by: Matthew Brost Link: https://patch.msgid.link/20260223175145.1532801-1-varun.gupta@intel.com Signed-off-by: Tejas Upadhyay (cherry picked from commit 29bd06faf727a4b76663e4be0f7d770e2d2a7965) Signed-off-by: Rodrigo Vivi diff --git a/drivers/gpu/drm/xe/xe_vm_madvise.c b/drivers/gpu/drm/xe/xe_vm_madvise.c index 95bf53cc29e3..bc39a9a9790c 100644 --- a/drivers/gpu/drm/xe/xe_vm_madvise.c +++ b/drivers/gpu/drm/xe/xe_vm_madvise.c @@ -453,7 +453,7 @@ int xe_vm_madvise_ioctl(struct drm_device *dev, void *data, struct drm_file *fil madvise_range.num_vmas, args->atomic.val)) { err = -EINVAL; - goto madv_fini; + goto free_vmas; } } @@ -490,6 +490,7 @@ int xe_vm_madvise_ioctl(struct drm_device *dev, void *data, struct drm_file *fil err_fini: if (madvise_range.has_bo_vmas) drm_exec_fini(&exec); +free_vmas: kfree(madvise_range.vmas); madvise_range.vmas = NULL; madv_fini: