CVE-2026-98511: drm/nouveau: don't bump pin count on failed re-pin in nouveau_bo_pin_locked()
In the Linux kernel, the following vulnerability has been resolved:
drm/nouveau: don't bump pin count on failed re-pin in nouveaubopinlocked()
nouveaubopinlocked() checks whether an already pinned BO is in a memory domain compatible with a new pin request. When the domains are incompatible, it sets -EBUSY but still calls ttmbopin() before returning.
Callers treat a failed nouveaubopin() as not having acquired a new pin, so the extra pin count is never decreased by a matching unpin. This triggers the warning in ttmborelease():
WARNONONCE(bo->pincount);
Found when fuzzing the nouveau driver with a modified Syzkaller:
WARNING: drivers/gpu/drm/ttm/ttmbo.c:256 at ttmborelease+0x827/0x9e0 drivers/gpu/drm/ttm/ttmbo.c:256, CPU#1: syz.3.24/2212 Modules linked in: CPU: 1 UID: 0 PID: 2212 Comm: syz.3.24 Not tainted 7.2.0 #24 PREEMPT(lazy) nouveau 0000:01:00.0: gsp:msg fn:103 len:0x40/0x20 res:0x19 resp:0x19 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014 RIP: 0010:ttmborelease+0x827/0x9e0 drivers/gpu/drm/ttm/ttmbo.c:256 Code: 02 00 0f 85 51 01 00 00 48 8b 7b 08 e8 d2 20 01 00 e9 80 fd ff ff e8 d8 15 c0 fe 90 0f 0b 90 e9 e1 f8 ff ff e8 ca 15 c0 fe 90 <0f> 0b 90 e9 a4 f8 ff ff e8 bc 15 c0 fe be 03 00 00 00 4c 89 e7 e8 msg: 00000000: 05 00 d0 c1 04 00 f0 f1 01 30 00 00 2d 90 00 00 .........0..-... RSP: 0018:ffffc9000f5cf710 EFLAGS: 00010293 RAX: 0000000000000000 RBX: ffff888018e5d2a8 RCX: ffffffff82bb1b36 RDX: ffff888017b68000 RSI: 0000000000000004 RDI: ffff888018e5d2a8 msg: 00000010: 19 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ RBP: ffff88801261c720 R08: 0000000000000001 R09: ffffed10031cba55 R10: ffff888018e5d2ab R11: 00000000000000f3 R12: ffff888018e5d290 R13: ffff888018e5d2d4 R14: ffff88801b219c18 R15: dffffc0000000000 FS: 0000000000000000(0000) GS:ffff8880e0f6f000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000001b31223ffc CR3: 0000000028e00005 CR4: 0000000000770ef0 PKRU: 80000000 Call Trace: <TASK> krefput include/linux/kref.h:65 [inline] ttmboput drivers/gpu/drm/ttm/ttmbo.c:325 [inline] ttmbofini+0x55/0x80 drivers/gpu/drm/ttm/ttmbo.c:330 nouveaugemobjectdel+0xb2/0x1b0 drivers/gpu/drm/nouveau/nouveaugem.c:90 drmgemobjectfree+0x5f/0x90 drivers/gpu/drm/drmgem.c:1165 krefput include/linux/kref.h:65 [inline] drmgemobjectput include/drm/drmgem.h:562 [inline] drmgemobjectput include/drm/drmgem.h:575 [inline] nouveauabi16chanfini.constprop.0+0x44f/0x5a0 drivers/gpu/drm/nouveau/nouveauabi16.c:195 nouveau 0000:01:00.0: syz.2.23[2209]: Unknown handle 0x00000000 nouveauabi16fini+0x1d0/0x340 drivers/gpu/drm/nouveau/nouveauabi16.c:225 nouveaudrmpostclose+0x18b/0x3e0 drivers/gpu/drm/nouveau/nouveaudrm.c:1284 nouveau 0000:01:00.0: syz.2.23[2209]: validateinit drmfilefree.part.0+0x6d6/0xb60 drivers/gpu/drm/drmfile.c:267 drmfilefree drivers/gpu/drm/drmfile.c:237 [inline] drmclosehelper.isra.0+0x11a/0x160 drivers/gpu/drm/drmfile.c:290 drmrelease+0x1ab/0x330 drivers/gpu/drm/drmfile.c:438 fput+0x39c/0xa60 fs/filetable.c:512 nouveau 0000:01:00.0: syz.2.23[2209]: validate: -2 taskworkrun+0x15a/0x230 kernel/taskwork.c:233 exittaskwork include/linux/taskwork.h:40 [inline] doexit+0x82b/0x25a0 kernel/exit.c:1009 dogroupexit+0xc2/0x280 kernel/exit.c:1152 getsignal+0x1d6e/0x1f30 kernel/signal.c:3046 archdosignalorrestart+0x7d/0x6e0 arch/x86/kernel/signal.c:337 exittousermodeloop kernel/entry/common.c:66 [inline] exittousermodeloop+0xdf/0x440 kernel/entry/common.c:101 exittousermodeprepare include/linux/irq-entry-common.h:207 [inline] syscallexittousermodeprepare include/linux/irq-entry-common.h:230 [inline] syscallexittousermode include/linux/entry-common.h:318 [inline] dosyscall64+0x4f8/0x690 arch/x86/entry/syscall64.c:100 entrySYSCALL64afterhwframe+0x77/0x7f RI ---truncated---