[PATCH v2 07/10] pseries/plpks: hide wrapping_features when unsupported

R Nageswara Sastry rnsastry at linux.ibm.com
Fri Sep 4 06:16:10 UTC 2026


On 31.08.2026 4:47 PM, Srish Srinivasan wrote:
> The PLPKS wrapping features config is only valid on systems that support
> the "Key Wrapping" feature. Currently the config is always exposed, even
> when the feature is unavailable.
>
> Add is_visible attribute_group callback to suppress the wrapping features
> sysfs attribute when the "Key Wrapping" feature is not supported. Declare
> the attribute group static const, as it is not modified after
> initialization.
>
> Fixes: 447eb1d5ef00 ("pseries/plpks: expose PowerVM wrapping features via the sysfs")
> Cc: stable at vger.kernel.org
> Signed-off-by: Srish Srinivasan <ssrish at linux.ibm.com>
Tested-by: R Nageswara Sastry <rnsastry at linux.ibm.com>

Tested on ppc64le PowerVM LPARs:
   - Firmware with wrap/unwrap support: 
/sys/firmware/plpks/config/wrapping_features
     is present and readable.
   - Firmware without wrap/unwrap support: the wrapping_features attribute
     is correctly absent from sysfs.
> ---
>   arch/powerpc/platforms/pseries/plpks-sysfs.c | 20 +++++++++++++++-----
>   1 file changed, 15 insertions(+), 5 deletions(-)
>
> diff --git a/arch/powerpc/platforms/pseries/plpks-sysfs.c b/arch/powerpc/platforms/pseries/plpks-sysfs.c
> index c2ebcbb41ae3..f2436229f323 100644
> --- a/arch/powerpc/platforms/pseries/plpks-sysfs.c
> +++ b/arch/powerpc/platforms/pseries/plpks-sysfs.c
> @@ -45,6 +45,16 @@ static const struct attribute *config_attrs[] = {
>   
>   static struct kobject *plpks_kobj, *plpks_config_kobj;
>   
> +static umode_t plpks_config_attr_is_visible(struct kobject *kobj,
> +					    struct attribute *attr, int n)
> +{
> +	if (attr == &attr_wrapping_features.attr &&
> +	    !plpks_wrapping_is_supported())
> +		return 0;
> +
> +	return attr->mode;
> +}
> +
>   int plpks_config_create_softlink(struct kobject *from)
>   {
>   	if (!plpks_config_kobj)
> @@ -52,13 +62,13 @@ int plpks_config_create_softlink(struct kobject *from)
>   	return sysfs_create_link(from, plpks_config_kobj, "config");
>   }
>   
> +static const struct attribute_group config_group = {
> +	.attrs = (struct attribute **)config_attrs,
> +	.is_visible = plpks_config_attr_is_visible,
> +};
> +
>   static __init int plpks_sysfs_config(struct kobject *kobj)
>   {
> -	struct attribute_group config_group = {
> -		.name = NULL,
> -		.attrs = (struct attribute **)config_attrs,
> -	};
> -
>   	return sysfs_create_group(kobj, &config_group);
>   }
>   

-- 
Thanks and Regards
R.Nageswara Sastry




More information about the Linux-security-module-archive mailing list