diff options
author | Rohan Kollambalath <rkollamb@digi.com> | 2024-02-12 08:36:34 +1000 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2024-03-07 22:04:50 +0000 |
commit | a54c1d1b859a57a99d5cbdce37ac754cbdd9344a (patch) | |
tree | 3cd19b831894774317777adcff06c2c97fa206db | |
parent | 8dde8fa0cc3edce73c050b9882d06c1a575f6402 (diff) | |
download | linux-a54c1d1b859a57a99d5cbdce37ac754cbdd9344a.tar.gz linux-a54c1d1b859a57a99d5cbdce37ac754cbdd9344a.tar.bz2 linux-a54c1d1b859a57a99d5cbdce37ac754cbdd9344a.zip |
sysfs:Addresses documentation in sysfs_merge_group and sysfs_unmerge_group.
These functions take a struct attribute_group as an input which has an
optional .name field. These functions rely on the .name field being
populated and do not check if its null. They pass this name into other
functions, eventually leading to a null pointer dereference.
This change simply updates the documentation of the function to make
this requirement clear.
Signed-off-by: Rohan Kollambalath <rkollamb@digi.com>
Link: https://lore.kernel.org/r/20240211223634.2103665-1-rohankollambalath@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | fs/sysfs/group.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/fs/sysfs/group.c b/fs/sysfs/group.c index 8c63ba3cfc47..d22ad67a0f32 100644 --- a/fs/sysfs/group.c +++ b/fs/sysfs/group.c @@ -345,13 +345,13 @@ void sysfs_remove_groups(struct kobject *kobj, EXPORT_SYMBOL_GPL(sysfs_remove_groups); /** - * sysfs_merge_group - merge files into a pre-existing attribute group. + * sysfs_merge_group - merge files into a pre-existing named attribute group. * @kobj: The kobject containing the group. * @grp: The files to create and the attribute group they belong to. * - * This function returns an error if the group doesn't exist or any of the - * files already exist in that group, in which case none of the new files - * are created. + * This function returns an error if the group doesn't exist, the .name field is + * NULL or any of the files already exist in that group, in which case none of + * the new files are created. */ int sysfs_merge_group(struct kobject *kobj, const struct attribute_group *grp) @@ -383,7 +383,7 @@ int sysfs_merge_group(struct kobject *kobj, EXPORT_SYMBOL_GPL(sysfs_merge_group); /** - * sysfs_unmerge_group - remove files from a pre-existing attribute group. + * sysfs_unmerge_group - remove files from a pre-existing named attribute group. * @kobj: The kobject containing the group. * @grp: The files to remove and the attribute group they belong to. */ |