[PATCH] staging: greybus: audio_manager_module: make module attributes read-only

From: Vinícius Bruno

Date: Fri Dec 04 2026 - 16:47:26 EST


The name, vid, pid, intf_id, ip_devices and op_devices attributes are
declared with mode 0664, but none of them provides a store() callback.

As a result, the files appear writable to their owner and group, and a
write passes the permission check only to fail with -EIO in
gb_audio_module_attr_store(), since attribute->store is NULL.

Set the mode to 0444 so the permissions reflect that these attributes
are read-only, and writes are rejected up front with -EACCES.

This changes the file mode shown for these attributes, but no attribute
was writable before, so no working userspace interface is lost.

Compile-tested only with W=1; not tested on Greybus hardware.

The commit message was drafted with the help of an AI assistant
(Claude) and reviewed by the author.

Signed-off-by: Vinícius Bruno <vinibruno.dev@xxxxxxxxx>
---
drivers/staging/greybus/audio_manager_module.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/greybus/audio_manager_module.c b/drivers/staging/greybus/audio_manager_module.c
index dc90cc2d2308..ccd8f0bb84fb 100644
--- a/drivers/staging/greybus/audio_manager_module.c
+++ b/drivers/staging/greybus/audio_manager_module.c
@@ -79,7 +79,7 @@ static ssize_t gb_audio_module_name_show(struct gb_audio_manager_module *module,
}

static struct gb_audio_manager_module_attribute gb_audio_module_name_attribute =
- __ATTR(name, 0664, gb_audio_module_name_show, NULL);
+ __ATTR(name, 0444, gb_audio_module_name_show, NULL);

static ssize_t gb_audio_module_vid_show(struct gb_audio_manager_module *module,
struct gb_audio_manager_module_attribute *attr, char *buf)
@@ -88,7 +88,7 @@ static ssize_t gb_audio_module_vid_show(struct gb_audio_manager_module *module,
}

static struct gb_audio_manager_module_attribute gb_audio_module_vid_attribute =
- __ATTR(vid, 0664, gb_audio_module_vid_show, NULL);
+ __ATTR(vid, 0444, gb_audio_module_vid_show, NULL);

static ssize_t gb_audio_module_pid_show(struct gb_audio_manager_module *module,
struct gb_audio_manager_module_attribute *attr, char *buf)
@@ -97,7 +97,7 @@ static ssize_t gb_audio_module_pid_show(struct gb_audio_manager_module *module,
}

static struct gb_audio_manager_module_attribute gb_audio_module_pid_attribute =
- __ATTR(pid, 0664, gb_audio_module_pid_show, NULL);
+ __ATTR(pid, 0444, gb_audio_module_pid_show, NULL);

static ssize_t gb_audio_module_intf_id_show(struct gb_audio_manager_module *module,
struct gb_audio_manager_module_attribute *attr,
@@ -108,7 +108,7 @@ static ssize_t gb_audio_module_intf_id_show(struct gb_audio_manager_module *modu

static struct gb_audio_manager_module_attribute
gb_audio_module_intf_id_attribute =
- __ATTR(intf_id, 0664, gb_audio_module_intf_id_show, NULL);
+ __ATTR(intf_id, 0444, gb_audio_module_intf_id_show, NULL);

static ssize_t gb_audio_module_ip_devices_show(struct gb_audio_manager_module *module,
struct gb_audio_manager_module_attribute *attr,
@@ -119,7 +119,7 @@ static ssize_t gb_audio_module_ip_devices_show(struct gb_audio_manager_module *m

static struct gb_audio_manager_module_attribute
gb_audio_module_ip_devices_attribute =
- __ATTR(ip_devices, 0664, gb_audio_module_ip_devices_show, NULL);
+ __ATTR(ip_devices, 0444, gb_audio_module_ip_devices_show, NULL);

static ssize_t gb_audio_module_op_devices_show(struct gb_audio_manager_module *module,
struct gb_audio_manager_module_attribute *attr,
@@ -130,7 +130,7 @@ static ssize_t gb_audio_module_op_devices_show(struct gb_audio_manager_module *m

static struct gb_audio_manager_module_attribute
gb_audio_module_op_devices_attribute =
- __ATTR(op_devices, 0664, gb_audio_module_op_devices_show, NULL);
+ __ATTR(op_devices, 0444, gb_audio_module_op_devices_show, NULL);

static struct attribute *gb_audio_module_default_attrs[] = {
&gb_audio_module_name_attribute.attr,
--
2.53.0