Skip to content

Commit

Permalink
drm/debugfs: disallow debugfs access when device isn't registered
Browse files Browse the repository at this point in the history
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 <christian.koenig@amd.com>
Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230829110115.3442-3-christian.koenig@amd.com
  • Loading branch information
Christian König authored and ChristianKoenigAMD committed Aug 31, 2023
1 parent e76e7ec commit 7a0f217
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions drivers/gpu/drm/drm_debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,13 +150,20 @@ static int drm_debugfs_open(struct inode *inode, struct file *file)
{
struct drm_info_node *node = inode->i_private;

if (!device_is_registered(node->minor->kdev))
return -ENODEV;

return single_open(file, node->info_ent->show, node);
}

static int drm_debugfs_entry_open(struct inode *inode, struct file *file)
{
struct drm_debugfs_entry *entry = inode->i_private;
struct drm_debugfs_info *node = &entry->file;
struct drm_minor *minor = entry->dev->primary ?: entry->dev->accel;

if (!device_is_registered(minor->kdev))
return -ENODEV;

return single_open(file, node->show, entry);
}
Expand Down

0 comments on commit 7a0f217

Please sign in to comment.