[syzbot] [dri?] WARNING in drm_prime_destroy_file_private (3)

0 views
Skip to first unread message

syzbot

unread,
3:56 PM (3 hours ago) 3:56 PM
to air...@gmail.com, dri-...@lists.freedesktop.org, linux-...@vger.kernel.org, maarten....@linux.intel.com, mri...@kernel.org, sim...@ffwll.ch, syzkall...@googlegroups.com, tzimm...@suse.de
Hello,

syzbot found the following issue on:

HEAD commit: 81d6f7807536 Merge tag 'v7.1-rc3-smb3-client-fixes' of git..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=159b10c8580000
kernel config: https://syzkaller.appspot.com/x/.config?x=59da38148f3a3d24
dashboard link: https://syzkaller.appspot.com/bug?extid=d7c9eed171647e421013
compiler: gcc (Debian 14.2.0-19) 14.2.0, GNU ld (GNU Binutils for Debian) 2.44
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=12332a73980000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=161a3dba580000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/61f8711360b2/disk-81d6f780.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/ddb7a0f311fa/vmlinux-81d6f780.xz
kernel image: https://storage.googleapis.com/syzbot-assets/4c64e3d1de5c/bzImage-81d6f780.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+d7c9ee...@syzkaller.appspotmail.com

------------[ cut here ]------------
!RB_EMPTY_ROOT(&prime_fpriv->dmabufs)
WARNING: drivers/gpu/drm/drm_prime.c:224 at drm_prime_destroy_file_private+0x48/0x60 drivers/gpu/drm/drm_prime.c:224, CPU#0: syz.0.17/5833
Modules linked in:
CPU: 0 UID: 0 PID: 5833 Comm: syz.0.17 Not tainted syzkaller #0 PREEMPT(full)
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/18/2026
RIP: 0010:drm_prime_destroy_file_private+0x48/0x60 drivers/gpu/drm/drm_prime.c:224
Code: 48 89 fa 48 c1 ea 03 80 3c 02 00 75 2b 48 8b 83 88 00 00 00 48 85 c0 75 0b e8 84 dd 65 fc 5b e9 7e d5 ea 05 e8 79 dd 65 fc 90 <0f> 0b 90 e8 70 dd 65 fc 5b c3 cc cc cc cc e8 85 95 d3 fc eb ce 0f
RSP: 0018:ffffc90003487ca0 EFLAGS: 00010293
RAX: 0000000000000000 RBX: ffff88807e729328 RCX: ffffffff8b8bb2bd
RDX: ffff888030b68000 RSI: ffffffff85a2b5a7 RDI: ffff88807e7293b0
RBP: ffff88807e729000 R08: 0000000000000001 R09: fffff52000690f74
R10: ffffc90003487ba7 R11: ffffffff82761cc4 R12: ffff8880276dc000
R13: ffff88807e729260 R14: 0000000000000000 R15: ffff88807e729288
FS: 000055555c7ad500(0000) GS:ffff888124373000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fe5c5586400 CR3: 0000000072cb9000 CR4: 00000000003526f0
Call Trace:
<TASK>
drm_file_free.part.0+0x7e6/0xcc0 drivers/gpu/drm/drm_file.c:269
drm_file_free drivers/gpu/drm/drm_file.c:237 [inline]
drm_close_helper.isra.0+0x186/0x200 drivers/gpu/drm/drm_file.c:290
drm_release+0x1ab/0x360 drivers/gpu/drm/drm_file.c:438
__fput+0x3ff/0xb50 fs/file_table.c:510
task_work_run+0x150/0x240 kernel/task_work.c:233
resume_user_mode_work include/linux/resume_user_mode.h:50 [inline]
__exit_to_user_mode_loop kernel/entry/common.c:67 [inline]
exit_to_user_mode_loop+0x100/0x4a0 kernel/entry/common.c:98
__exit_to_user_mode_prepare include/linux/irq-entry-common.h:207 [inline]
syscall_exit_to_user_mode_prepare include/linux/irq-entry-common.h:238 [inline]
syscall_exit_to_user_mode include/linux/entry-common.h:318 [inline]
do_syscall_64+0x706/0xf80 arch/x86/entry/syscall_64.c:100
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fe5c559cdd9
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 e8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffd7c1af318 EFLAGS: 00000246 ORIG_RAX: 00000000000001b4
RAX: 0000000000000000 RBX: 00007ffd7c1af400 RCX: 00007fe5c559cdd9
RDX: 0000000000000000 RSI: 000000000000001e RDI: 0000000000000003
RBP: 00000000000117cd R08: 0000000000000001 R09: 0000000000000000
R10: 0000001b33020000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007fe5c5815fac R14: 00007fe5c5815fa8 R15: 00007fe5c5815fa0
</TASK>


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.

If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup

Hillf Danton

unread,
5:17 PM (2 hours ago) 5:17 PM
to syzbot, linux-...@vger.kernel.org, syzkall...@googlegroups.com
> Date: Tue, 12 May 2026 12:56:33 -0700 [thread overview]
> Hello,
>
> syzbot found the following issue on:
>
> HEAD commit: 81d6f7807536 Merge tag 'v7.1-rc3-smb3-client-fixes' of git..
> git tree: upstream
> console output: https://syzkaller.appspot.com/x/log.txt?x=159b10c8580000
> kernel config: https://syzkaller.appspot.com/x/.config?x=59da38148f3a3d24
> dashboard link: https://syzkaller.appspot.com/bug?extid=d7c9eed171647e421013
> compiler: gcc (Debian 14.2.0-19) 14.2.0, GNU ld (GNU Binutils for Debian) 2.44
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=12332a73980000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=161a3dba580000

Test Edward's fix.

#syz test

--- x/drivers/gpu/drm/drm_gem.c
+++ y/drivers/gpu/drm/drm_gem.c
@@ -374,14 +374,8 @@ drm_gem_object_release_handle(int id, vo
if (obj->funcs->close)
obj->funcs->close(obj, file_priv);

- mutex_lock(&file_priv->prime.lock);
-
drm_prime_remove_buf_handle(&file_priv->prime, id);
-
- mutex_unlock(&file_priv->prime.lock);
-
drm_vma_node_revoke(&obj->vma_node, file_priv);
-
drm_gem_object_handle_put_unlocked(obj);

return 0;
@@ -401,13 +395,16 @@ drm_gem_handle_delete(struct drm_file *f
{
struct drm_gem_object *obj;

+ mutex_lock(&filp->prime.lock);
spin_lock(&filp->table_lock);

/* Check if we currently have a reference on the object */
obj = idr_replace(&filp->object_idr, NULL, handle);
spin_unlock(&filp->table_lock);
- if (IS_ERR_OR_NULL(obj))
+ if (IS_ERR_OR_NULL(obj)) {
+ mutex_unlock(&filp->prime.lock);
return -EINVAL;
+ }

/* Release driver's reference and decrement refcount. */
drm_gem_object_release_handle(handle, obj, filp);
@@ -416,6 +413,7 @@ drm_gem_handle_delete(struct drm_file *f
spin_lock(&filp->table_lock);
idr_remove(&filp->object_idr, handle);
spin_unlock(&filp->table_lock);
+ mutex_unlock(&filp->prime.lock);

return 0;
}
@@ -1030,17 +1028,18 @@ int drm_gem_change_handle_ioctl(struct d
return -EINVAL;
handle = args->new_handle;

+ mutex_lock(&file_priv->prime.lock);
obj = drm_gem_object_lookup(file_priv, args->handle);
- if (!obj)
+ if (!obj) {
+ mutex_unlock(&file_priv->prime.lock);
return -ENOENT;
+ }

if (args->handle == handle) {
ret = 0;
- goto out;
+ goto out_unlock;
}

- mutex_lock(&file_priv->prime.lock);
-
spin_lock(&file_priv->table_lock);

/* When create_tail allocs an obj idr, it needs to first alloc as NULL,
@@ -1092,9 +1091,8 @@ int drm_gem_change_handle_ioctl(struct d
spin_unlock(&file_priv->table_lock);

out_unlock:
- mutex_unlock(&file_priv->prime.lock);
-out:
drm_gem_object_put(obj);
+ mutex_unlock(&file_priv->prime.lock);

return ret;
}
@@ -1126,8 +1124,10 @@ drm_gem_open(struct drm_device *dev, str
void
drm_gem_release(struct drm_device *dev, struct drm_file *file_private)
{
+ mutex_lock(&file_private->prime.lock);
idr_for_each(&file_private->object_idr,
&drm_gem_object_release_handle, file_private);
+ mutex_unlock(&file_private->prime.lock);
idr_destroy(&file_private->object_idr);
}

--

syzbot

unread,
5:44 PM (1 hour ago) 5:44 PM
to hda...@sina.com, linux-...@vger.kernel.org, syzkall...@googlegroups.com
Hello,

syzbot has tested the proposed patch but the reproducer is still triggering an issue:
WARNING in drm_prime_destroy_file_private

------------[ cut here ]------------
!RB_EMPTY_ROOT(&prime_fpriv->dmabufs)
WARNING: drivers/gpu/drm/drm_prime.c:224 at drm_prime_destroy_file_private+0x48/0x60 drivers/gpu/drm/drm_prime.c:224, CPU#0: syz.0.17/6410
Modules linked in:
CPU: 0 UID: 0 PID: 6410 Comm: syz.0.17 Not tainted syzkaller #0 PREEMPT(full)
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/18/2026
RIP: 0010:drm_prime_destroy_file_private+0x48/0x60 drivers/gpu/drm/drm_prime.c:224
Code: 48 89 fa 48 c1 ea 03 80 3c 02 00 75 2b 48 8b 83 88 00 00 00 48 85 c0 75 0b e8 14 d0 65 fc 5b e9 4e e4 ea 05 e8 09 d0 65 fc 90 <0f> 0b 90 e8 00 d0 65 fc 5b c3 cc cc cc cc e8 95 8e d3 fc eb ce 0f
RSP: 0018:ffffc90002f77c90 EFLAGS: 00010293
RAX: 0000000000000000 RBX: ffff88802ad7e328 RCX: ffffffff8b8be29d
RDX: ffff888038710000 RSI: ffffffff85a2d6d7 RDI: ffff88802ad7e3b0
RBP: ffff88802ad7e000 R08: 0000000000000001 R09: fffff520005eef72
R10: ffffc90002f77b97 R11: ffffffff82763704 R12: ffff8880274f6000
R13: ffff88802ad7e260 R14: 0000000000000000 R15: ffff88802ad7e288
FS: 000055555a33f500(0000) GS:ffff888124372000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f33e59e9000 CR3: 000000005f403000 CR4: 00000000003526f0
Call Trace:
<TASK>
drm_file_free.part.0+0x7e6/0xcc0 drivers/gpu/drm/drm_file.c:269
drm_file_free drivers/gpu/drm/drm_file.c:237 [inline]
drm_close_helper.isra.0+0x186/0x200 drivers/gpu/drm/drm_file.c:290
drm_release+0x1ab/0x360 drivers/gpu/drm/drm_file.c:438
__fput+0x3ff/0xb50 fs/file_table.c:510
task_work_run+0x150/0x240 kernel/task_work.c:233
resume_user_mode_work include/linux/resume_user_mode.h:50 [inline]
__exit_to_user_mode_loop kernel/entry/common.c:67 [inline]
exit_to_user_mode_loop+0x107/0x4f0 kernel/entry/common.c:98
__exit_to_user_mode_prepare include/linux/irq-entry-common.h:207 [inline]
syscall_exit_to_user_mode_prepare include/linux/irq-entry-common.h:238 [inline]
syscall_exit_to_user_mode include/linux/entry-common.h:318 [inline]
do_syscall_64+0x706/0xf80 arch/x86/entry/syscall_64.c:100
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f33e579cdd9
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 e8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffece825a08 EFLAGS: 00000246 ORIG_RAX: 00000000000001b4
RAX: 0000000000000000 RBX: 00007ffece825af0 RCX: 00007f33e579cdd9
RDX: 0000000000000000 RSI: 000000000000001e RDI: 0000000000000003
RBP: 000000000001dd1e R08: 0000000000000001 R09: 0000000000000000
R10: 0000001b2c920000 R11: 0000000000000246 R12: 00007ffece825b30
R13: 00007f33e5a15fac R14: 000000000001dd56 R15: 00007f33e5a15fa0
</TASK>


Tested on:

commit: 1d5dcaa3 Merge tag 'probes-fixes-v7.1-rc3' of git://gi..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=13d7c7ce580000
kernel config: https://syzkaller.appspot.com/x/.config?x=59da38148f3a3d24
dashboard link: https://syzkaller.appspot.com/bug?extid=d7c9eed171647e421013
compiler: gcc (Debian 14.2.0-19) 14.2.0, GNU ld (GNU Binutils for Debian) 2.44
patch: https://syzkaller.appspot.com/x/patch.diff?x=1164ebce580000

Reply all
Reply to author
Forward
0 new messages