From: "Vinícius Bruno" <vinibruno.dev@gmail.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Vaibhav Agarwal" <vaibhav.sr@gmail.com>,
"Mark Greer" <mgreer@animalcreek.com>,
"Johan Hovold" <johan@kernel.org>,
"Alex Elder" <elder@kernel.org>,
greybus-dev@lists.linaro.org, linux-staging@lists.linux.dev,
linux-kernel@vger.kernel.org,
"Vinícius Bruno" <vinibruno.dev@gmail.com>
Subject: [PATCH] staging: greybus: audio_manager_module: make module attributes read-only
Date: Fri, 4 Dec 2026 18:47:07 -0300 [thread overview]
Message-ID: <20261204214707.152059-1-vinibruno.dev@gmail.com> (raw)
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@gmail.com>
---
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
next reply other threads:[~2026-12-04 21:47 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-04 21:47 Vinícius Bruno [this message]
2026-12-04 21:53 ` [PATCH] staging: greybus: audio_manager_module: make module attributes read-only Greg Kroah-Hartman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261204214707.152059-1-vinibruno.dev@gmail.com \
--to=vinibruno.dev@gmail.com \
--cc=elder@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=greybus-dev@lists.linaro.org \
--cc=johan@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=mgreer@animalcreek.com \
--cc=vaibhav.sr@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox