From: Hillf Danton <hdanton@sina.com>
To: syzbot <syzbot+b2e951687503f32f74ce@syzkaller.appspotmail.com>
Cc: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: Re: [syzbot] [dri?] KASAN: slab-use-after-free Read in drm_gem_object_release_handle
Date: Tue, 14 Apr 2026 16:46:47 +0800 [thread overview]
Message-ID: <20260414084648.1801-1-hdanton@sina.com> (raw)
In-Reply-To: <69dd24f4.a00a0220.468cb.004a.GAE@google.com>
> Date: Mon, 13 Apr 2026 10:16:36 -0700 [thread overview]
> Hello,
>
> syzbot found the following issue on:
>
> HEAD commit: f5459048c38a Merge tag 'i2c-for-7.0-final' of git://git.ke..
> git tree: upstream
> console output: https://syzkaller.appspot.com/x/log.txt?x=1028d106580000
> kernel config: https://syzkaller.appspot.com/x/.config?x=6754c86e8d9e4c91
> dashboard link: https://syzkaller.appspot.com/bug?extid=b2e951687503f32f74ce
> compiler: Debian clang version 21.1.8 (++20251221033036+2078da43e25a-1~exp1~20251221153213.50), Debian LLD 21.1.8
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1428d106580000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=17509036580000
#syz test
--- x/drivers/gpu/drm/drm_gem.c
+++ y/drivers/gpu/drm/drm_gem.c
@@ -387,6 +387,24 @@ drm_gem_object_release_handle(int id, vo
return 0;
}
+static int
+drm_gem_object_release_idr_handle(int id, void *ptr, void *data)
+{
+ struct drm_file *filp = data;
+ struct drm_gem_object *obj, *tmp = ptr;
+
+ spin_lock(&filp->table_lock);
+ obj = idr_replace(&filp->object_idr, NULL, id);
+ idr_remove(&filp->object_idr, id);
+ spin_unlock(&filp->table_lock);
+ if (IS_ERR_OR_NULL(obj))
+ return 0;
+ if (obj != tmp)
+ return 0;
+ drm_gem_object_release_handle(id, obj, filp);
+ return 0;
+}
+
/**
* drm_gem_handle_delete - deletes the given file-private handle
* @filp: drm file-private structure to use for the handle look up
@@ -405,6 +423,7 @@ drm_gem_handle_delete(struct drm_file *f
/* Check if we currently have a reference on the object */
obj = idr_replace(&filp->object_idr, NULL, handle);
+ idr_remove(&filp->object_idr, handle);
spin_unlock(&filp->table_lock);
if (IS_ERR_OR_NULL(obj))
return -EINVAL;
@@ -412,11 +431,6 @@ drm_gem_handle_delete(struct drm_file *f
/* Release driver's reference and decrement refcount. */
drm_gem_object_release_handle(handle, obj, filp);
- /* And finally make the handle available for future allocations. */
- spin_lock(&filp->table_lock);
- idr_remove(&filp->object_idr, handle);
- spin_unlock(&filp->table_lock);
-
return 0;
}
EXPORT_SYMBOL(drm_gem_handle_delete);
@@ -1086,7 +1100,7 @@ void
drm_gem_release(struct drm_device *dev, struct drm_file *file_private)
{
idr_for_each(&file_private->object_idr,
- &drm_gem_object_release_handle, file_private);
+ &drm_gem_object_release_idr_handle, file_private);
idr_destroy(&file_private->object_idr);
}
--
next prev parent reply other threads:[~2026-04-14 8:47 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-13 17:16 [syzbot] [dri?] KASAN: slab-use-after-free Read in drm_gem_object_release_handle syzbot
2026-04-14 0:16 ` Forwarded: [PATCH] drm/gem: fix use-after-free in drm_gem_release syzbot
2026-04-14 1:32 ` syzbot
2026-04-14 5:00 ` [syzbot] [dri?] KASAN: slab-use-after-free Read in drm_gem_object_release_handle Hillf Danton
2026-04-14 5:26 ` syzbot
2026-04-14 5:49 ` Forwarded: [PATCH] drm/gem: fix use-after-free in drm_gem_release syzbot
2026-04-14 8:46 ` Hillf Danton [this message]
2026-04-14 9:04 ` [syzbot] [dri?] KASAN: slab-use-after-free Read in drm_gem_object_release_handle syzbot
2026-04-14 10:03 ` Hillf Danton
2026-04-14 10:20 ` syzbot
2026-04-15 0:33 ` Hillf Danton
2026-04-15 3:54 ` syzbot
2026-04-15 7:50 ` Hillf Danton
[not found] <20260414001626.60471-1-kartikey406@gmail.com>
2026-04-14 0:36 ` syzbot
[not found] <20260414013225.64095-1-kartikey406@gmail.com>
2026-04-14 1:50 ` syzbot
[not found] <20260414054951.69728-1-kartikey406@gmail.com>
2026-04-14 6:22 ` syzbot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260414084648.1801-1-hdanton@sina.com \
--to=hdanton@sina.com \
--cc=linux-kernel@vger.kernel.org \
--cc=syzbot+b2e951687503f32f74ce@syzkaller.appspotmail.com \
--cc=syzkaller-bugs@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox