Skip to content

Commit 7a0f217

Browse files
Christian KönigChristianKoenigAMD
Christian König
authored andcommitted
drm/debugfs: disallow debugfs access when device isn't registered
During device bringup it might be that we can't access the debugfs files. Return -ENODEV until the registration is completed on access. Signed-off-by: Christian König <[email protected]> Reviewed-by: Andi Shyti <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent e76e7ec commit 7a0f217

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

drivers/gpu/drm/drm_debugfs.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,13 +150,20 @@ static int drm_debugfs_open(struct inode *inode, struct file *file)
150150
{
151151
struct drm_info_node *node = inode->i_private;
152152

153+
if (!device_is_registered(node->minor->kdev))
154+
return -ENODEV;
155+
153156
return single_open(file, node->info_ent->show, node);
154157
}
155158

156159
static int drm_debugfs_entry_open(struct inode *inode, struct file *file)
157160
{
158161
struct drm_debugfs_entry *entry = inode->i_private;
159162
struct drm_debugfs_info *node = &entry->file;
163+
struct drm_minor *minor = entry->dev->primary ?: entry->dev->accel;
164+
165+
if (!device_is_registered(minor->kdev))
166+
return -ENODEV;
160167

161168
return single_open(file, node->show, entry);
162169
}

0 commit comments

Comments
 (0)