* [PATCH] sysfs: attribute_group: Respect is_visible_const() when changing owner
@ 2026-04-03 16:31 Thomas Weißschuh
2026-04-03 17:52 ` Michael Kelley
2026-04-08 22:17 ` Danilo Krummrich
0 siblings, 2 replies; 3+ messages in thread
From: Thomas Weißschuh @ 2026-04-03 16:31 UTC (permalink / raw)
To: Greg Kroah-Hartman, Rafael J. Wysocki, Danilo Krummrich
Cc: driver-core, linux-kernel, stable, Michael Kelley,
Thomas Weißschuh
The call to grp->is_visible in sysfs_group_attrs_change_owner() was
missed when support for is_visible_const() was added.
Check for both is_visible variants there too.
Fixes: 7dd9fdb4939b ("sysfs: attribute_group: enable const variants of is_visible()")
Cc: stable@vger.kernel.org
Reported-by: Michael Kelley <mhklinux@outlook.com>
Closes: https://lore.kernel.org/lkml/SN6PR02MB4157D5F04608E4E3C21AB56ED45EA@SN6PR02MB4157.namprd02.prod.outlook.com/
Link: https://sashiko.dev/#/patchset/20260403-sysfs-const-hv-v2-0-8932ab8d41db%40weissschuh.net
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
Currently there are no implementations of 'is_visible_const()' in the
tree, so this should not affect any code.
---
fs/sysfs/group.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/fs/sysfs/group.c b/fs/sysfs/group.c
index e1e639f515a0..989edd6c6c23 100644
--- a/fs/sysfs/group.c
+++ b/fs/sysfs/group.c
@@ -517,8 +517,11 @@ static int sysfs_group_attrs_change_owner(struct kobject *kobj,
struct attribute *const *attr;
for (i = 0, attr = grp->attrs; *attr; i++, attr++) {
- if (grp->is_visible) {
- mode = grp->is_visible(kobj, *attr, i);
+ if (grp->is_visible || grp->is_visible_const) {
+ if (grp->is_visible)
+ mode = grp->is_visible(kobj, *attr, i);
+ else
+ mode = grp->is_visible_const(kobj, *attr, i);
if (mode & SYSFS_GROUP_INVISIBLE)
break;
if (!mode)
---
base-commit: d8a9a4b11a137909e306e50346148fc5c3b63f9d
change-id: 20260403-sysfs-is_visible_const-fix-74bd09223a65
Best regards,
--
Thomas Weißschuh <linux@weissschuh.net>
^ permalink raw reply related [flat|nested] 3+ messages in thread* RE: [PATCH] sysfs: attribute_group: Respect is_visible_const() when changing owner
2026-04-03 16:31 [PATCH] sysfs: attribute_group: Respect is_visible_const() when changing owner Thomas Weißschuh
@ 2026-04-03 17:52 ` Michael Kelley
2026-04-08 22:17 ` Danilo Krummrich
1 sibling, 0 replies; 3+ messages in thread
From: Michael Kelley @ 2026-04-03 17:52 UTC (permalink / raw)
To: Thomas Weißschuh, Greg Kroah-Hartman, Rafael J. Wysocki,
Danilo Krummrich
Cc: driver-core@lists.linux.dev, linux-kernel@vger.kernel.org,
stable@vger.kernel.org, Michael Kelley
From: Thomas Weißschuh <linux@weissschuh.net> Sent: Friday, April 3, 2026 9:31 AM
>
> The call to grp->is_visible in sysfs_group_attrs_change_owner() was
> missed when support for is_visible_const() was added.
>
> Check for both is_visible variants there too.
>
> Fixes: 7dd9fdb4939b ("sysfs: attribute_group: enable const variants of is_visible()")
> Cc: stable@vger.kernel.org
> Reported-by: Michael Kelley <mhklinux@outlook.com>
> Closes: https://lore.kernel.org/lkml/SN6PR02MB4157D5F04608E4E3C21AB56ED45EA@SN6PR02MB4157.namprd02.prod.outlook.com/
> Link: https://sashiko.dev/#/patchset/20260403-sysfs-const-hv-v2-0-8932ab8d41db%40weissschuh.net
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Reviewed-by: Michael Kelley <mhklinux@outlook.com>
> ---
> Currently there are no implementations of 'is_visible_const()' in the
> tree, so this should not affect any code.
> ---
> fs/sysfs/group.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/fs/sysfs/group.c b/fs/sysfs/group.c
> index e1e639f515a0..989edd6c6c23 100644
> --- a/fs/sysfs/group.c
> +++ b/fs/sysfs/group.c
> @@ -517,8 +517,11 @@ static int sysfs_group_attrs_change_owner(struct kobject *kobj,
> struct attribute *const *attr;
>
> for (i = 0, attr = grp->attrs; *attr; i++, attr++) {
> - if (grp->is_visible) {
> - mode = grp->is_visible(kobj, *attr, i);
> + if (grp->is_visible || grp->is_visible_const) {
> + if (grp->is_visible)
> + mode = grp->is_visible(kobj, *attr, i);
> + else
> + mode = grp->is_visible_const(kobj, *attr, i);
> if (mode & SYSFS_GROUP_INVISIBLE)
> break;
> if (!mode)
>
> ---
> base-commit: d8a9a4b11a137909e306e50346148fc5c3b63f9d
> change-id: 20260403-sysfs-is_visible_const-fix-74bd09223a65
>
> Best regards,
> --
> Thomas Weißschuh <linux@weissschuh.net>
>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] sysfs: attribute_group: Respect is_visible_const() when changing owner
2026-04-03 16:31 [PATCH] sysfs: attribute_group: Respect is_visible_const() when changing owner Thomas Weißschuh
2026-04-03 17:52 ` Michael Kelley
@ 2026-04-08 22:17 ` Danilo Krummrich
1 sibling, 0 replies; 3+ messages in thread
From: Danilo Krummrich @ 2026-04-08 22:17 UTC (permalink / raw)
To: Thomas Weißschuh
Cc: Greg Kroah-Hartman, Rafael J. Wysocki, driver-core, linux-kernel,
stable, Michael Kelley
On Fri Apr 3, 2026 at 6:31 PM CEST, Thomas Weißschuh wrote:
> The call to grp->is_visible in sysfs_group_attrs_change_owner() was
> missed when support for is_visible_const() was added.
>
> Check for both is_visible variants there too.
>
> Fixes: 7dd9fdb4939b ("sysfs: attribute_group: enable const variants of is_visible()")
> Cc: stable@vger.kernel.org
> Reported-by: Michael Kelley <mhklinux@outlook.com>
> Closes: https://lore.kernel.org/lkml/SN6PR02MB4157D5F04608E4E3C21AB56ED45EA@SN6PR02MB4157.namprd02.prod.outlook.com/
> Link: https://sashiko.dev/#/patchset/20260403-sysfs-const-hv-v2-0-8932ab8d41db%40weissschuh.net
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Applied to driver-core-testing, thanks!
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-04-08 22:17 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-03 16:31 [PATCH] sysfs: attribute_group: Respect is_visible_const() when changing owner Thomas Weißschuh
2026-04-03 17:52 ` Michael Kelley
2026-04-08 22:17 ` Danilo Krummrich
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox