From: John Garry <john.g.garry@oracle.com>
To: Damien Le Moal <dlemoal@kernel.org>,
"Martin K . Petersen" <martin.petersen@oracle.com>,
linux-scsi@vger.kernel.org
Subject: Re: [PATCH] scsi: Correct sysfs attributes access rights
Date: Mon, 28 Jul 2025 10:40:27 +0100 [thread overview]
Message-ID: <d3d6659e-dfff-4f4f-ad3b-afe053fe736d@oracle.com> (raw)
In-Reply-To: <20250728041700.76660-1-dlemoal@kernel.org>
On 28/07/2025 05:17, Damien Le Moal wrote:
> The scsi sysfs attributes "supported_mode" and "active_mode" do not
> define a store method and thus cannot be modified. Correct the
> DEVICE_ATTR() call for these two attributes to not include S_IWUSR to
> allow write access as they are read-only.
>
> Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: John Garry <john.g.garry@oracle.com>
Note that class_attr_store() returns -EIO for no store method. Does the
same happen after this change?
> ---
> drivers/scsi/scsi_sysfs.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
> index d772258e29ad..e6464b998960 100644
> --- a/drivers/scsi/scsi_sysfs.c
> +++ b/drivers/scsi/scsi_sysfs.c
> @@ -265,7 +265,7 @@ show_shost_supported_mode(struct device *dev, struct device_attribute *attr,
> return show_shost_mode(supported_mode, buf);
> }
>
> -static DEVICE_ATTR(supported_mode, S_IRUGO | S_IWUSR, show_shost_supported_mode, NULL);
> +static DEVICE_ATTR(supported_mode, S_IRUGO, show_shost_supported_mode, NULL);
>
> static ssize_t
> show_shost_active_mode(struct device *dev,
> @@ -279,7 +279,7 @@ show_shost_active_mode(struct device *dev,
> return show_shost_mode(shost->active_mode, buf);
> }
>
> -static DEVICE_ATTR(active_mode, S_IRUGO | S_IWUSR, show_shost_active_mode, NULL);
> +static DEVICE_ATTR(active_mode, S_IRUGO, show_shost_active_mode, NULL);
>
> static int check_reset_type(const char *str)
> {
next prev parent reply other threads:[~2025-07-28 9:40 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-28 4:17 [PATCH] scsi: Correct sysfs attributes access rights Damien Le Moal
2025-07-28 9:40 ` John Garry [this message]
2025-07-28 9:52 ` Damien Le Moal
2025-07-28 9:57 ` John Garry
2025-07-28 10:46 ` Johannes Thumshirn
2025-07-29 2:33 ` Martin K. Petersen
2025-08-06 2:39 ` Martin K. Petersen
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=d3d6659e-dfff-4f4f-ad3b-afe053fe736d@oracle.com \
--to=john.g.garry@oracle.com \
--cc=dlemoal@kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.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