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 9F06B576EC1; Wed, 9 Sep 2026 14:33:27 +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=1788964408; cv=none; b=AxkgI+mSGlOeM3URI/8ua3WCzohpszTsjojLg71+Z95RXrx77KdVeUgauvU1rMK+uk3aUOEbIglUGS/oK3GanvyTcZjFsG+RFvW/GxZet3toFwWBkBVKVfUuAH8Xw9dVS+ojsk58whb3oxYxFtXJiFe/6Zu8XQ6cUqBAQNZ2L6c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788964408; c=relaxed/simple; bh=m29wNzoS+T8OIka80fqQjjTz/XezhMB7pDW3Rtetsjw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZxPp0lu0mXRtA78P/aE/0EUPEg2Hg5sIsL77RcnuM2a9anhEXTBbPLwaPwjKcbLmcBAQ6O2OtEotYbeAdzUDScmLlHdCdPBwOasQTP0pEhKO/p5coa1vixnDO84g2Vn99U6iN14Pm00FZ5rHVTBh1Ffyhrnc3UmTeXS+f7HfKjk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=LVdtMr3t; 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="LVdtMr3t" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 06F161F00A3A; Wed, 9 Sep 2026 14:33:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1788964407; bh=Nr2GVQo0XQ5e1Yzfn7/mk3IAJP/rWJZgDSSwFlUtCIM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=LVdtMr3t00Kxpv7Ulnb0mIjZlUkaRs6h0nPDhs7Zy6q8rVSVadtFJni4iEFv31mf/ l3rg2pkne/UBoi0mllUP7qmTDBF8D+/VodRTZLXjPi4HUj/Gkf7wkkXPFxE6Q3QLsX OWmwyv93+6UWpHyPsmRgxveacP3rTNr+e4wNivdA= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Yuhao Jiang , Zhenhao Wan , Lyude Paul , Danilo Krummrich Subject: [PATCH 6.18 412/583] drm/nouveau/uvmm: fix NULL deref unwinding an OP_MAP_SPARSE op Date: Wed, 9 Sep 2026 15:41:37 +0200 Message-ID: <20260909134252.253699059@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260909134237.773280130@linuxfoundation.org> References: <20260909134237.773280130@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Zhenhao Wan commit 412a6ceb56d501ef2f8202e26ab4b5d4dfbca566 upstream. Each bind_job_op is zeroed by kzalloc_obj() in bind_job_op_from_uop(), and the OP_MAP_SPARSE case in nouveau_uvmm_bind_job_submit() only creates a region, so op->ops stays NULL for a successfully processed sparse map. If a later op in the same job fails, the reverse unwind loop revisits that op and calls drm_gpuva_ops_free(&uvmm->base, op->ops) unconditionally. drm_gpuva_ops_free() dereferences its argument right away (list_for_each_entry_safe on &ops->list), so a NULL op->ops oopses. The path is reachable by any render-node fd holder, since NOUVEAU_VM_BIND is DRM_RENDER_ALLOW. Guard the free with IS_ERR_OR_NULL(), as nouveau_uvmm_bind_job_cleanup() already does for the identical free. Fixes: b88baab82871 ("drm/nouveau: implement new VM_BIND uAPI") Reported-by: Yuhao Jiang Assisted-by: Claude:claude-opus-5 Cc: stable@vger.kernel.org Signed-off-by: Zhenhao Wan Reviewed-by: Lyude Paul Link: https://patch.msgid.link/20260811-nouveau-uvmm-vmbind-fixes-v2-1-aaee4b395d04@gmail.com Signed-off-by: Danilo Krummrich Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/nouveau/nouveau_uvmm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/gpu/drm/nouveau/nouveau_uvmm.c +++ b/drivers/gpu/drm/nouveau/nouveau_uvmm.c @@ -1421,7 +1421,8 @@ unwind: break; } - drm_gpuva_ops_free(&uvmm->base, op->ops); + if (!IS_ERR_OR_NULL(op->ops)) + drm_gpuva_ops_free(&uvmm->base, op->ops); op->ops = NULL; op->reg = NULL; }