mirror of
https://github.com/edk2-porting/linux-next.git
synced 2025-01-12 15:44:01 +08:00
LSM: turn sb_eat_lsm_opts() into a method
Kill ->sb_copy_data() - it's used only in combination with immediately following ->sb_parse_opts_str(). Turn that combination into a new method. This is just a mechanical move - cleanups will be the next step. Reviewed-by: David Howells <dhowells@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
6a0440e5b7
commit
5b40023911
@ -1461,7 +1461,7 @@ union security_list_options {
|
|||||||
|
|
||||||
int (*sb_alloc_security)(struct super_block *sb);
|
int (*sb_alloc_security)(struct super_block *sb);
|
||||||
void (*sb_free_security)(struct super_block *sb);
|
void (*sb_free_security)(struct super_block *sb);
|
||||||
int (*sb_copy_data)(char *orig, char *copy);
|
int (*sb_eat_lsm_opts)(char *orig, struct security_mnt_opts *opts);
|
||||||
int (*sb_remount)(struct super_block *sb,
|
int (*sb_remount)(struct super_block *sb,
|
||||||
struct security_mnt_opts *opts);
|
struct security_mnt_opts *opts);
|
||||||
int (*sb_kern_mount)(struct super_block *sb);
|
int (*sb_kern_mount)(struct super_block *sb);
|
||||||
@ -1801,7 +1801,7 @@ struct security_hook_heads {
|
|||||||
struct hlist_head bprm_committed_creds;
|
struct hlist_head bprm_committed_creds;
|
||||||
struct hlist_head sb_alloc_security;
|
struct hlist_head sb_alloc_security;
|
||||||
struct hlist_head sb_free_security;
|
struct hlist_head sb_free_security;
|
||||||
struct hlist_head sb_copy_data;
|
struct hlist_head sb_eat_lsm_opts;
|
||||||
struct hlist_head sb_remount;
|
struct hlist_head sb_remount;
|
||||||
struct hlist_head sb_kern_mount;
|
struct hlist_head sb_kern_mount;
|
||||||
struct hlist_head sb_show_options;
|
struct hlist_head sb_show_options;
|
||||||
|
@ -386,16 +386,7 @@ void security_sb_free(struct super_block *sb)
|
|||||||
|
|
||||||
int security_sb_eat_lsm_opts(char *options, struct security_mnt_opts *opts)
|
int security_sb_eat_lsm_opts(char *options, struct security_mnt_opts *opts)
|
||||||
{
|
{
|
||||||
char *s = (char *)get_zeroed_page(GFP_KERNEL);
|
return call_int_hook(sb_eat_lsm_opts, 0, options, opts);
|
||||||
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_eat_lsm_opts);
|
EXPORT_SYMBOL(security_sb_eat_lsm_opts);
|
||||||
|
|
||||||
|
@ -2810,6 +2810,20 @@ out:
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int selinux_sb_eat_lsm_opts(char *options, struct security_mnt_opts *opts)
|
||||||
|
{
|
||||||
|
char *s = (char *)get_zeroed_page(GFP_KERNEL);
|
||||||
|
int err;
|
||||||
|
|
||||||
|
if (!s)
|
||||||
|
return -ENOMEM;
|
||||||
|
err = selinux_sb_copy_data(options, s);
|
||||||
|
if (!err)
|
||||||
|
err = selinux_parse_opts_str(s, opts);
|
||||||
|
free_page((unsigned long)s);
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
static int selinux_sb_remount(struct super_block *sb,
|
static int selinux_sb_remount(struct super_block *sb,
|
||||||
struct security_mnt_opts *opts)
|
struct security_mnt_opts *opts)
|
||||||
{
|
{
|
||||||
@ -6863,7 +6877,7 @@ static struct security_hook_list selinux_hooks[] __lsm_ro_after_init = {
|
|||||||
|
|
||||||
LSM_HOOK_INIT(sb_alloc_security, selinux_sb_alloc_security),
|
LSM_HOOK_INIT(sb_alloc_security, selinux_sb_alloc_security),
|
||||||
LSM_HOOK_INIT(sb_free_security, selinux_sb_free_security),
|
LSM_HOOK_INIT(sb_free_security, selinux_sb_free_security),
|
||||||
LSM_HOOK_INIT(sb_copy_data, selinux_sb_copy_data),
|
LSM_HOOK_INIT(sb_eat_lsm_opts, selinux_sb_eat_lsm_opts),
|
||||||
LSM_HOOK_INIT(sb_remount, selinux_sb_remount),
|
LSM_HOOK_INIT(sb_remount, selinux_sb_remount),
|
||||||
LSM_HOOK_INIT(sb_kern_mount, selinux_sb_kern_mount),
|
LSM_HOOK_INIT(sb_kern_mount, selinux_sb_kern_mount),
|
||||||
LSM_HOOK_INIT(sb_show_options, selinux_sb_show_options),
|
LSM_HOOK_INIT(sb_show_options, selinux_sb_show_options),
|
||||||
|
@ -739,6 +739,20 @@ out_err:
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int smack_sb_eat_lsm_opts(char *options, struct security_mnt_opts *opts)
|
||||||
|
{
|
||||||
|
char *s = (char *)get_zeroed_page(GFP_KERNEL);
|
||||||
|
int err;
|
||||||
|
|
||||||
|
if (!s)
|
||||||
|
return -ENOMEM;
|
||||||
|
err = smack_sb_copy_data(options, s);
|
||||||
|
if (!err)
|
||||||
|
err = smack_parse_opts_str(s, opts);
|
||||||
|
free_page((unsigned long)s);
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* smack_set_mnt_opts - set Smack specific mount options
|
* smack_set_mnt_opts - set Smack specific mount options
|
||||||
* @sb: the file system superblock
|
* @sb: the file system superblock
|
||||||
@ -4637,7 +4651,7 @@ static struct security_hook_list smack_hooks[] __lsm_ro_after_init = {
|
|||||||
|
|
||||||
LSM_HOOK_INIT(sb_alloc_security, smack_sb_alloc_security),
|
LSM_HOOK_INIT(sb_alloc_security, smack_sb_alloc_security),
|
||||||
LSM_HOOK_INIT(sb_free_security, smack_sb_free_security),
|
LSM_HOOK_INIT(sb_free_security, smack_sb_free_security),
|
||||||
LSM_HOOK_INIT(sb_copy_data, smack_sb_copy_data),
|
LSM_HOOK_INIT(sb_eat_lsm_opts, smack_sb_eat_lsm_opts),
|
||||||
LSM_HOOK_INIT(sb_statfs, smack_sb_statfs),
|
LSM_HOOK_INIT(sb_statfs, smack_sb_statfs),
|
||||||
LSM_HOOK_INIT(sb_set_mnt_opts, smack_set_mnt_opts),
|
LSM_HOOK_INIT(sb_set_mnt_opts, smack_set_mnt_opts),
|
||||||
LSM_HOOK_INIT(sb_parse_opts_str, smack_parse_opts_str),
|
LSM_HOOK_INIT(sb_parse_opts_str, smack_parse_opts_str),
|
||||||
|
Loading…
Reference in New Issue
Block a user