diff options
author | André Almeida <andrealmeid@igalia.com> | 2024-11-01 13:42:50 -0300 |
---|---|---|
committer | Christian Brauner <brauner@kernel.org> | 2024-11-06 11:22:20 +0100 |
commit | 18d2f10f6284f5bb9c03a759044121c71e5b3b4c (patch) | |
tree | aefc2de0be279347a9f1d6c4054ff398cd06dd21 /drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | |
parent | 33b091c08ed85e023c21376e6f787355fd46b440 (diff) | |
download | linux-18d2f10f6284f5bb9c03a759044121c71e5b3b4c.tar.gz linux-18d2f10f6284f5bb9c03a759044121c71e5b3b4c.tar.bz2 linux-18d2f10f6284f5bb9c03a759044121c71e5b3b4c.zip |
tmpfs: Fix type for sysfs' casefold attribute
DEVICE_STRING_ATTR_RO should be only used by device drivers since it
relies on `struct device` to use device_show_string() function. Using
this with non device code led to a kCFI violation:
> cat /sys/fs/tmpfs/features/casefold
[ 70.558496] CFI failure at kobj_attr_show+0x2c/0x4c (target: device_show_string+0x0/0x38; expected type: 0xc527b809)
Like the other filesystems, fix this by manually declaring the attribute
using kobj_attribute() and writing a proper show() function.
Also, leave macros for anyone that need to expand tmpfs sysfs' with
more attributes.
Fixes: 5132f08bd332 ("tmpfs: Expose filesystem features via sysfs")
Reported-by: Nathan Chancellor <nathan@kernel.org>
Closes: https://lore.kernel.org/lkml/20241031051822.GA2947788@thelio-3990X/
Signed-off-by: André Almeida <andrealmeid@igalia.com>
Link: https://lore.kernel.org/r/20241101164251.327884-3-andrealmeid@igalia.com
Tested-by: Nathan Chancellor <nathan@kernel.org>
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Christian Brauner <brauner@kernel.org>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c')
0 files changed, 0 insertions, 0 deletions