From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail3-164.sinamail.sina.com.cn (mail3-164.sinamail.sina.com.cn [202.108.3.164]) (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 65895224AF7 for ; Tue, 14 Apr 2026 05:00:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.108.3.164 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776142862; cv=none; b=WfESIZU4+6TTV2I5J78ouuXxGzZ7HC4RFkFCV/d+Ph/rEMdeGHYYLRU60TEvHNWOpiMoeSrHCkrvLCKNGHGVJhylI9lEyjVryd6ohDO1STGQhv85Jm+/I7+f4SHr9gqwa9KiRJs7l16LLPTVqnIGn9ECoyzACatk8CmDPJ1TLnk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776142862; c=relaxed/simple; bh=BHsDSaBTL5ka+bTIHlyDkHSLy9QNoz1L2h/EAJUmIz0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hUa7bQ0VPheYRRc3J8W3rVFoXtLA6p9gVjwud3hA6AvGz44eqelK9p8f18lmbyt317JP09PXX6msJqANBQtuZMso5TqTls+/tTX4V+NOCyx+Ajm1sOaoki4zfWd4zI6KsWzIPnSl//DoQvduw8aAUH4FNA7m1CyQOnkSqWDBS2o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sina.com; spf=pass smtp.mailfrom=sina.com; dkim=pass (1024-bit key) header.d=sina.com header.i=@sina.com header.b=c2KtHMMt; arc=none smtp.client-ip=202.108.3.164 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sina.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sina.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=sina.com header.i=@sina.com header.b="c2KtHMMt" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sina.com; s=201208; t=1776142858; bh=dwpHQnYgS5ffTwQXEFM+XdskPXR2dB6/dNxnAx2OnRg=; h=From:Subject:Date:Message-ID; b=c2KtHMMtMVUZXj337ClBUP/jaw8ABxK7hmNmA7/zbS4zSO3XucHcgdIAh6DUGMsRS h5ZqzZHzd8TI0vigchf1Rsw+36FnSdAm+afVJOMdDJurGIW443ReRBOak1l8VUdQXK EpVuAocWLPBx30q8HbQOizi2up0Z3B+Kdt/SFPq4= X-SMAIL-HELO: localhost.localdomain Received: from unknown (HELO localhost.localdomain)([114.249.62.144]) by sina.com (10.54.253.32) with ESMTP id 69DDC9DC00005F5D; Tue, 14 Apr 2026 13:00:13 +0800 (CST) X-Sender: hdanton@sina.com X-Auth-ID: hdanton@sina.com Authentication-Results: sina.com; spf=none smtp.mailfrom=hdanton@sina.com; dkim=none header.i=none; dmarc=none action=none header.from=hdanton@sina.com X-SMAIL-MID: 7319034456619 X-SMAIL-UIID: 2C2A94B6D8284ACA9BBC5FE88F95A8D5-20260414-130013-1 From: Hillf Danton To: syzbot 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 13:00:04 +0800 Message-ID: <20260414050005.1782-1-hdanton@sina.com> In-Reply-To: <69dd24f4.a00a0220.468cb.004a.GAE@google.com> References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit > 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,23 @@ 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); + 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 @@ -1086,7 +1103,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); } --