From f5c0c26d9008b355babb6d16f3d7c4de3bada0e7 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Sat, 17 Nov 2018 12:09:18 -0500 Subject: new helper: security_sb_eat_lsm_opts() combination of alloc_secdata(), security_sb_copy_data(), security_sb_parse_opt_str() and free_secdata(). Reviewed-by: David Howells Signed-off-by: Al Viro --- security/security.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'security/security.c') diff --git a/security/security.c b/security/security.c index 3f50beb30fb1..02c656dd5c0c 100644 --- a/security/security.c +++ b/security/security.c @@ -384,11 +384,20 @@ void security_sb_free(struct super_block *sb) call_void_hook(sb_free_security, sb); } -int security_sb_copy_data(char *orig, char *copy) +int security_sb_eat_lsm_opts(char *options, struct security_mnt_opts *opts) { - return call_int_hook(sb_copy_data, 0, orig, copy); + char *s = (char *)get_zeroed_page(GFP_KERNEL); + int err; + + if (!s) + return -ENOMEM; + err = call_int_hook(sb_copy_data, 0, options, s); + if (!err) + err = call_int_hook(sb_parse_opts_str, 0, s, opts); + free_page((unsigned long)s); + return err; } -EXPORT_SYMBOL(security_sb_copy_data); +EXPORT_SYMBOL(security_sb_eat_lsm_opts); int security_sb_remount(struct super_block *sb, struct security_mnt_opts *opts) -- cgit v1.2.3-59-g8ed1b