From mboxrd@z Thu Jan 1 00:00:00 1970 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 CE8263DE44E; Mon, 4 May 2026 14:08:05 +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=1777903685; cv=none; b=odHK6x8USItc/jDd0GH/4fcGDIMcJuX2FU1TT7nfEHXqUyyx5Nn2px1jqnJ8f8vYqAIHnbbQ3R/+7PgfKJSGPk2Bf0ypLceusOG0hkh5uafDONxssIJspVYvMXMHAaUuaDKXGVdh/72L/8azUfhfBlgzUUkYDkbLZOTukwwA0dY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777903685; c=relaxed/simple; bh=q/H4447A510bgLwJ9Ik8gdgQejB+Q1nh3TP/Zprau+w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GeyPGLCqHPQ5M676e1dP0k7Hj3JgplIS1YWhCDk8xBSoA2ytkS15ANjbDOcnFTuIevCacuzrZEV8rPU03QjiHO5WgEfWBrPCu3Qx/wVZiQ+VoZ758k8Tzcz7aP+9f0KGBeU0KVO7tb75P6kX/F0fpFBLXKvxw1o9AYArD6VnFN0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=zpIprSXQ; 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="zpIprSXQ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 637A7C2BCB8; Mon, 4 May 2026 14:08:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1777903685; bh=q/H4447A510bgLwJ9Ik8gdgQejB+Q1nh3TP/Zprau+w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zpIprSXQGpjHWoVQkPfBur4ElRY7L7v/21zmLcty++TK0ux4FcFstmmxx7bvIw+1m gwuWsm6V0JlVcrdzqoraeUiZk/DlQ3btPRoTZkTVKZEzfb1n6YkLnNd7T6kPyoaR/6 70kygaGrgPeYbD4L6NJ8N64esp3k6ywtN5Xh3t6A= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Lyude Paul , Danilo Krummrich , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , stable Subject: [PATCH 6.18 009/275] drm/nouveau: fix u32 overflow in pushbuf reloc bounds check Date: Mon, 4 May 2026 15:49:09 +0200 Message-ID: <20260504135143.285497046@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260504135142.929052779@linuxfoundation.org> References: <20260504135142.929052779@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: Greg Kroah-Hartman commit 2fc87d37be1b730a149b035f9375fdb8cc5333a5 upstream. nouveau_gem_pushbuf_reloc_apply() validates each relocation with if (r->reloc_bo_offset + 4 > nvbo->bo.base.size) but reloc_bo_offset is __u32 (uapi/drm/nouveau_drm.h) and the integer literal 4 promotes to unsigned int, so the addition is performed in 32 bits and wraps before the comparison against the size_t bo size. Cast to u64 so the addition happens in 64-bit arithmetic. Cc: Lyude Paul Cc: Danilo Krummrich Cc: Maarten Lankhorst Cc: Maxime Ripard Cc: Thomas Zimmermann Cc: David Airlie Cc: Simona Vetter Reported-by: Anthropic Cc: stable Assisted-by: gkh_clanker_t1000 Fixes: a1606a9596e5 ("drm/nouveau: new gem pushbuf interface, bump to 0.0.16") Signed-off-by: Greg Kroah-Hartman [ Add Fixes: tag. - Danilo ] Signed-off-by: Danilo Krummrich Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/nouveau/nouveau_gem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/gpu/drm/nouveau/nouveau_gem.c +++ b/drivers/gpu/drm/nouveau/nouveau_gem.c @@ -686,7 +686,7 @@ nouveau_gem_pushbuf_reloc_apply(struct n } nvbo = (void *)(unsigned long)bo[r->reloc_bo_index].user_priv; - if (unlikely(r->reloc_bo_offset + 4 > + if (unlikely((u64)r->reloc_bo_offset + 4 > nvbo->bo.base.size)) { NV_PRINTK(err, cli, "reloc outside of bo\n"); ret = -EINVAL;