FAILED: patch "[PATCH] drm/nouveau: fix u32 overflow in pushbuf reloc bounds check" failed to apply to 5.10-stable tree
Subsystems (4)
[email protected]
maintainerThe patch below does not apply to the 5.10-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 <[email protected]>.
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-5.10.y
git checkout FETCH_HEAD
git cherry-pick -x 2fc87d37be1b730a149b035f9375fdb8cc5333a5
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026042712-extrovert-oblong-a615@gregkh' --subject-prefix 'PATCH 5.10.y' HEAD^..
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 2fc87d37be1b730a149b035f9375fdb8cc5333a5 Mon Sep 17 00:00:00 2001
From: Greg Kroah-Hartman <[email protected]>
Date: Mon, 20 Apr 2026 21:16:09 +0200
Subject: [PATCH] drm/nouveau: fix u32 overflow in pushbuf reloc bounds check
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.
drivers/gpu/drm/nouveau/nouveau_gem.c +1 -1
@@ -686,7 +686,7 @@ nouveau_gem_pushbuf_reloc_apply(struct nouveau_cli *cli, } 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 ;
Sasha Levin
maintainerPATCH 1/1 drm/nouveau: fix u32 overflow in pushbuf reloc bounds check
From: Greg Kroah-Hartman <[email protected]>
[ Upstream commit 2fc87d37be1b730a149b035f9375fdb8cc5333a5 ]
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.
--- drivers/gpu/drm/nouveau/nouveau_gem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nouveau_gem.c +1 -1
@@ -618,7 +618,7 @@ nouveau_gem_pushbuf_reloc_apply(struct nouveau_cli *cli, } 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.mem.num_pages <<PAGE_SHIFT )) {NV_PRINTK (err, cli,"reloc outside of bo\n" ); ret = -EINVAL ;
Signature · 1 line
2.53.0