linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrei Vagin <avagin@openvz.org>
To: David Howells <dhowells@redhat.com>
Cc: linux-fsdevel@vger.kernel.org, Andrei Vagin <avagin@gmail.com>
Subject: [PATCH dhowells/mount-api] fs: return -ENOPARAM from security_fs_context_parse_param by default
Date: Thu,  6 Sep 2018 11:44:26 -0700	[thread overview]
Message-ID: <20180906184426.32413-1-avagin@openvz.org> (raw)
In-Reply-To: <18703.1536228984@warthog.procyon.org.uk>

From: Andrei Vagin <avagin@gmail.com>

It returns 0 to indicate that it processed the argument and that
the argument doesn't belong to the filesystem.  It returns -ENOPARAM to
indicate that the argument should be passed along to the filesystem.  Any
other error is an actual error. // David Howells <dhowells@redhat.com>

Signed-off-by: Andrei Vagin <avagin@gmail.com>
---
 include/linux/lsm_hooks.h | 4 ++++
 include/linux/security.h  | 2 +-
 security/security.c       | 2 +-
 3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/include/linux/lsm_hooks.h b/include/linux/lsm_hooks.h
index ceb487c3fbc7..d333ceebf056 100644
--- a/include/linux/lsm_hooks.h
+++ b/include/linux/lsm_hooks.h
@@ -103,6 +103,10 @@
  *	Validate the filesystem context preparatory to applying it.  This is
  *	done after all the options have been parsed.
  *	@fc indicates the filesystem context.
+ *	Returns 0 to indicate that it processed the argument and that the argument
+ *	doesn't belong to the filesystem. It returns -ENOPARAM to indicate that
+ *	the argument should be passed along to the filesystem. Any other error is
+ *	an actual error.
  * @sb_get_tree:
  *	Assign the security to a newly created superblock.
  *	@fc indicates the filesystem context.
diff --git a/include/linux/security.h b/include/linux/security.h
index dbed5326b45c..bae191a96c73 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -576,7 +576,7 @@ static inline void security_fs_context_free(struct fs_context *fc)
 static inline int security_fs_context_parse_param(struct fs_context *fc,
 						  struct fs_parameter *param)
 {
-	return 0;
+	return -ENOPARAM;
 }
 static inline int security_fs_context_validate(struct fs_context *fc)
 {
diff --git a/security/security.c b/security/security.c
index 94420f3616a7..64304d20aae1 100644
--- a/security/security.c
+++ b/security/security.c
@@ -380,7 +380,7 @@ void security_fs_context_free(struct fs_context *fc)
 
 int security_fs_context_parse_param(struct fs_context *fc, struct fs_parameter *param)
 {
-	return call_int_hook(fs_context_parse_param, 0, fc, param);
+	return call_int_hook(fs_context_parse_param, -ENOPARAM, fc, param);
 }
 
 int security_fs_context_validate(struct fs_context *fc)
-- 
2.17.1

  reply	other threads:[~2018-09-06 23:21 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-06  0:10 [PATCH dhowells/mount-api] fs: fix checking an error code of security_fs_context_parse_param Andrei Vagin
2018-09-06 10:16 ` David Howells
2018-09-06 18:44   ` Andrei Vagin [this message]
2018-09-06 23:08   ` Andrei Vagin
2018-09-11 20:15   ` [PATCH dhowells/mount-api] fs: return -ENOPARAM from security_fs_context_parse_param by default David Howells
2018-09-06 10:18 ` [PATCH dhowells/mount-api] fs: fix checking an error code of security_fs_context_parse_param David Howells
2018-09-11  5:12   ` Andrei Vagin
2018-09-11 20:13   ` David Howells

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=20180906184426.32413-1-avagin@openvz.org \
    --to=avagin@openvz.org \
    --cc=avagin@gmail.com \
    --cc=dhowells@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).