From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Wolfram Sang <wsa+renesas@sang-engineering.com>
Cc: linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
"Rafael J. Wysocki" <rafael@kernel.org>
Subject: Re: [PATCH] debugfs: only accept read attributes for blobs
Date: Tue, 4 May 2021 14:59:55 +0200 [thread overview]
Message-ID: <YJFFSxOh2M27vtX+@kroah.com> (raw)
In-Reply-To: <20210504121721.43385-1-wsa+renesas@sang-engineering.com>
On Tue, May 04, 2021 at 02:17:20PM +0200, Wolfram Sang wrote:
> Blobs can only be read. So, keep only 'read' file attributes because the
> others will not work and only confuse users.
>
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> ---
>
> I was confused for a second, thinking blobs can be written to. I will
> fix the few in-kernel users doing it wrong seperately.
>
> fs/debugfs/file.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c
> index 686e0ad28788..d6aa6e04b7af 100644
> --- a/fs/debugfs/file.c
> +++ b/fs/debugfs/file.c
> @@ -890,7 +890,8 @@ static const struct file_operations fops_blob = {
> /**
> * debugfs_create_blob - create a debugfs file that is used to read a binary blob
> * @name: a pointer to a string containing the name of the file to create.
> - * @mode: the permission that the file should have
> + * @mode: the read permission that the file should have (other permissions are
> + * masked out)
> * @parent: a pointer to the parent dentry for this file. This should be a
> * directory dentry if set. If this parameter is %NULL, then the
> * file will be created in the root of the debugfs filesystem.
> @@ -914,7 +915,7 @@ struct dentry *debugfs_create_blob(const char *name, umode_t mode,
> struct dentry *parent,
> struct debugfs_blob_wrapper *blob)
> {
> - return debugfs_create_file_unsafe(name, mode, parent, blob, &fops_blob);
> + return debugfs_create_file_unsafe(name, mode & S_IRUGO, parent, blob, &fops_blob);
Can you use an octal number for this? I think checkpatch.pl will
complain here.
thanks,
greg k-h
prev parent reply other threads:[~2021-05-04 13:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-04 12:17 [PATCH] debugfs: only accept read attributes for blobs Wolfram Sang
2021-05-04 12:59 ` Greg Kroah-Hartman [this message]
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=YJFFSxOh2M27vtX+@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=wsa+renesas@sang-engineering.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