platform/chrome: cros_ec_debugfs: Fix permissions for panicinfo
authorAvadhut Naik <Avadhut.Naik@amd.com>
Thu, 16 Nov 2023 22:47:24 +0000 (16:47 -0600)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 21 Nov 2023 20:10:44 +0000 (21:10 +0100)
The debugfs_create_blob() function has been used to create read-only binary
blobs in debugfs. The function filters out permissions, other than S_IRUSR,
S_IRGRP and S_IROTH, provided while creating the blobs.

The very behavior though is being changed through previous patch in the
series (fs: debugfs: Add write functionality to debugfs blobs) which makes
the binary blobs writable by owners. Thus, all permissions provided while
creating the blobs, except S_IRUSR,S_IWUSR, S_IRGRP, S_IROTH, will be
filtered by debugfs_create_blob().

As such, rectify the permissions of panicinfo file since the S_IFREG flag
was anyways being filtered out by debugfs_create_blob(). Moreover, the
very flag will always be set be set for the panicinfo file through
__debugfs_create_file().

Signed-off-by: Avadhut Naik <Avadhut.Naik@amd.com>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Tony Luck <tony.luck@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/platform/chrome/cros_ec_debugfs.c

index 091fdc154d79132111b30f7c9ff5d64ec397b8b3..6bf6f0e7b59766991123ee572e46e1321d442e3d 100644 (file)
@@ -454,7 +454,7 @@ static int cros_ec_create_panicinfo(struct cros_ec_debugfs *debug_info)
        debug_info->panicinfo_blob.data = data;
        debug_info->panicinfo_blob.size = ret;
 
-       debugfs_create_blob("panicinfo", S_IFREG | 0444, debug_info->dir,
+       debugfs_create_blob("panicinfo", 0444, debug_info->dir,
                            &debug_info->panicinfo_blob);
 
        return 0;