From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from r3-17.sinamail.sina.com.cn (r3-17.sinamail.sina.com.cn [202.108.3.17]) (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 CD5CC391833 for ; Wed, 13 May 2026 03:13:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.108.3.17 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778642018; cv=none; b=JWmbv+vXSACIwwgqB2JggrSHzzfwu/rh1wzIjogcR1Afma2bn4G3myUUZt+c8yo//DQ/J3kHjmtslMuVQbQ0ivgW4Q5McgwZrpUziUVJkoVX4PHSgXGeYpmeTaYbvdpLNw1jSxqIii3vq1hp9LcBjxPuOmGhhi/uYUJ09sWXd2c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778642018; c=relaxed/simple; bh=3ArT+7pXFhs3BBBERlzyNQEXP7b69+XPu93PAgodpwY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OrtTMbqOn3pd84uUScJB7f7cHLjyVD/ffQYpvBbJIajOMY5Z7wwHcUNJPrvFq0ZhmAZnEqiExp1eRzs99m6q/ZEL3xAuUaGQaHOgPCiSqJrmH85ryorWXERUdSnQZ9V+a5EyJ0v7Eu5qnjmdBPm2hNOF6JKV4Nzf4eJ/9ssA9j0= 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=uyJsDPCG; arc=none smtp.client-ip=202.108.3.17 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="uyJsDPCG" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sina.com; s=201208; t=1778642014; bh=D7Tr9LXBR9Ec5eEGG08j4TsXJlXK2ar+o4/FXgQerms=; h=From:Subject:Date:Message-ID; b=uyJsDPCG9VqEqp6SB+BwtUdB+oKXwMpR9amHUFh9qR7KxUSpJZcvA+Je3ve1G4U24 C7y0RpH3ZASF/pv3g6p93Ydk8GqxyK5Jb4uP6/a0CxuM8nQWUboWh8/e83pnKnlXuB xQ7l8MlmAP8WcOPXul6VET04HF5sRuTWn4ENEFGs= X-SMAIL-HELO: localhost.localdomain Received: from unknown (HELO localhost.localdomain)([114.249.62.144]) by sina.com (10.54.253.34) with ESMTP id 6A03EC50000067B4; Wed, 13 May 2026 11:13:22 +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: 9461636291735 X-SMAIL-UIID: 339821A3A45C4B9780CEAAD910704DA8-20260513-111322-1 From: Hillf Danton To: syzbot Cc: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com Subject: Re: [syzbot] [dri?] WARNING in drm_prime_destroy_file_private (3) Date: Wed, 13 May 2026 11:13:17 +0800 Message-ID: <20260513031323.578-1-hdanton@sina.com> In-Reply-To: <6a0385f1.a00a0220.3890a0.0002.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: 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 #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); } --- x/drivers/gpu/drm/drm_file.c +++ y/drivers/gpu/drm/drm_file.c @@ -257,8 +257,7 @@ void drm_file_free(struct drm_file *file if (drm_core_check_feature(dev, DRIVER_SYNCOBJ)) drm_syncobj_release(file); - if (drm_core_check_feature(dev, DRIVER_GEM)) - drm_gem_release(dev, file); + drm_gem_release(dev, file); if (drm_is_primary_client(file)) drm_master_release(file); --