diff options
| -rw-r--r-- | fs/super.c | 8 | ||||
| -rw-r--r-- | include/linux/lsm_hooks.h | 3 | ||||
| -rw-r--r-- | include/linux/security.h | 6 | ||||
| -rw-r--r-- | security/security.c | 5 | ||||
| -rw-r--r-- | security/selinux/hooks.c | 10 | ||||
| -rw-r--r-- | security/smack/smack_lsm.c | 15 |
6 files changed, 13 insertions, 34 deletions
diff --git a/fs/super.c b/fs/super.c index d571527cb8b8..1f75fe312597 100644 --- a/fs/super.c +++ b/fs/super.c | |||
| @@ -1275,10 +1275,16 @@ mount_fs(struct file_system_type *type, int flags, const char *name, void *data) | |||
| 1275 | smp_wmb(); | 1275 | smp_wmb(); |
| 1276 | sb->s_flags |= SB_BORN; | 1276 | sb->s_flags |= SB_BORN; |
| 1277 | 1277 | ||
| 1278 | error = security_sb_kern_mount(sb, flags, &opts); | 1278 | error = security_sb_set_mnt_opts(sb, &opts, 0, NULL); |
| 1279 | if (error) | 1279 | if (error) |
| 1280 | goto out_sb; | 1280 | goto out_sb; |
| 1281 | 1281 | ||
| 1282 | if (!(flags & MS_KERNMOUNT)) { | ||
| 1283 | error = security_sb_kern_mount(sb); | ||
| 1284 | if (error) | ||
| 1285 | goto out_sb; | ||
| 1286 | } | ||
| 1287 | |||
| 1282 | /* | 1288 | /* |
| 1283 | * filesystems should never set s_maxbytes larger than MAX_LFS_FILESIZE | 1289 | * filesystems should never set s_maxbytes larger than MAX_LFS_FILESIZE |
| 1284 | * but s_maxbytes was an unsigned long long for many releases. Throw | 1290 | * but s_maxbytes was an unsigned long long for many releases. Throw |
diff --git a/include/linux/lsm_hooks.h b/include/linux/lsm_hooks.h index e1a12a1e2b32..f432123af0e3 100644 --- a/include/linux/lsm_hooks.h +++ b/include/linux/lsm_hooks.h | |||
| @@ -1464,8 +1464,7 @@ union security_list_options { | |||
| 1464 | int (*sb_copy_data)(char *orig, char *copy); | 1464 | int (*sb_copy_data)(char *orig, char *copy); |
| 1465 | int (*sb_remount)(struct super_block *sb, | 1465 | int (*sb_remount)(struct super_block *sb, |
| 1466 | struct security_mnt_opts *opts); | 1466 | struct security_mnt_opts *opts); |
| 1467 | int (*sb_kern_mount)(struct super_block *sb, int flags, | 1467 | int (*sb_kern_mount)(struct super_block *sb); |
| 1468 | struct security_mnt_opts *opts); | ||
| 1469 | int (*sb_show_options)(struct seq_file *m, struct super_block *sb); | 1468 | int (*sb_show_options)(struct seq_file *m, struct super_block *sb); |
| 1470 | int (*sb_statfs)(struct dentry *dentry); | 1469 | int (*sb_statfs)(struct dentry *dentry); |
| 1471 | int (*sb_mount)(const char *dev_name, const struct path *path, | 1470 | int (*sb_mount)(const char *dev_name, const struct path *path, |
diff --git a/include/linux/security.h b/include/linux/security.h index 262e59838803..d00093363570 100644 --- a/include/linux/security.h +++ b/include/linux/security.h | |||
| @@ -250,8 +250,7 @@ int security_sb_alloc(struct super_block *sb); | |||
| 250 | void security_sb_free(struct super_block *sb); | 250 | void security_sb_free(struct super_block *sb); |
| 251 | int security_sb_eat_lsm_opts(char *options, struct security_mnt_opts *opts); | 251 | int security_sb_eat_lsm_opts(char *options, struct security_mnt_opts *opts); |
| 252 | int security_sb_remount(struct super_block *sb, struct security_mnt_opts *opts); | 252 | int security_sb_remount(struct super_block *sb, struct security_mnt_opts *opts); |
| 253 | int security_sb_kern_mount(struct super_block *sb, int flags, | 253 | int security_sb_kern_mount(struct super_block *sb); |
| 254 | struct security_mnt_opts *opts); | ||
| 255 | int security_sb_show_options(struct seq_file *m, struct super_block *sb); | 254 | int security_sb_show_options(struct seq_file *m, struct super_block *sb); |
| 256 | int security_sb_statfs(struct dentry *dentry); | 255 | int security_sb_statfs(struct dentry *dentry); |
| 257 | int security_sb_mount(const char *dev_name, const struct path *path, | 256 | int security_sb_mount(const char *dev_name, const struct path *path, |
| @@ -568,8 +567,7 @@ static inline int security_sb_remount(struct super_block *sb, | |||
| 568 | return 0; | 567 | return 0; |
| 569 | } | 568 | } |
| 570 | 569 | ||
| 571 | static inline int security_sb_kern_mount(struct super_block *sb, int flags, | 570 | static inline int security_sb_kern_mount(struct super_block *sb) |
| 572 | struct security_mnt_opts *opts) | ||
| 573 | { | 571 | { |
| 574 | return 0; | 572 | return 0; |
| 575 | } | 573 | } |
diff --git a/security/security.c b/security/security.c index 02c656dd5c0c..afb05646d41b 100644 --- a/security/security.c +++ b/security/security.c | |||
| @@ -405,10 +405,9 @@ int security_sb_remount(struct super_block *sb, | |||
| 405 | return call_int_hook(sb_remount, 0, sb, opts); | 405 | return call_int_hook(sb_remount, 0, sb, opts); |
| 406 | } | 406 | } |
| 407 | 407 | ||
| 408 | int security_sb_kern_mount(struct super_block *sb, int flags, | 408 | int security_sb_kern_mount(struct super_block *sb) |
| 409 | struct security_mnt_opts *opts) | ||
| 410 | { | 409 | { |
| 411 | return call_int_hook(sb_kern_mount, 0, sb, flags, opts); | 410 | return call_int_hook(sb_kern_mount, 0, sb); |
| 412 | } | 411 | } |
| 413 | 412 | ||
| 414 | int security_sb_show_options(struct seq_file *m, struct super_block *sb) | 413 | int security_sb_show_options(struct seq_file *m, struct super_block *sb) |
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index ba3e2917bd24..59b164d7134d 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c | |||
| @@ -2874,18 +2874,10 @@ out_bad_option: | |||
| 2874 | return -EINVAL; | 2874 | return -EINVAL; |
| 2875 | } | 2875 | } |
| 2876 | 2876 | ||
| 2877 | static int selinux_sb_kern_mount(struct super_block *sb, int flags, | 2877 | static int selinux_sb_kern_mount(struct super_block *sb) |
| 2878 | struct security_mnt_opts *opts) | ||
| 2879 | { | 2878 | { |
| 2880 | const struct cred *cred = current_cred(); | 2879 | const struct cred *cred = current_cred(); |
| 2881 | struct common_audit_data ad; | 2880 | struct common_audit_data ad; |
| 2882 | int rc = selinux_set_mnt_opts(sb, opts, 0, NULL); | ||
| 2883 | if (rc) | ||
| 2884 | return rc; | ||
| 2885 | |||
| 2886 | /* Allow all mounts performed by the kernel */ | ||
| 2887 | if (flags & MS_KERNMOUNT) | ||
| 2888 | return 0; | ||
| 2889 | 2881 | ||
| 2890 | ad.type = LSM_AUDIT_DATA_DENTRY; | 2882 | ad.type = LSM_AUDIT_DATA_DENTRY; |
| 2891 | ad.u.dentry = sb->s_root; | 2883 | ad.u.dentry = sb->s_root; |
diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c index 1d465ae3d11c..50e6e88bfe70 100644 --- a/security/smack/smack_lsm.c +++ b/security/smack/smack_lsm.c | |||
| @@ -852,20 +852,6 @@ static int smack_set_mnt_opts(struct super_block *sb, | |||
| 852 | } | 852 | } |
| 853 | 853 | ||
| 854 | /** | 854 | /** |
| 855 | * smack_sb_kern_mount - Smack specific mount processing | ||
| 856 | * @sb: the file system superblock | ||
| 857 | * @flags: the mount flags | ||
| 858 | * @data: the smack mount options | ||
| 859 | * | ||
| 860 | * Returns 0 on success, an error code on failure | ||
| 861 | */ | ||
| 862 | static int smack_sb_kern_mount(struct super_block *sb, int flags, | ||
| 863 | struct security_mnt_opts *opts) | ||
| 864 | { | ||
| 865 | return smack_set_mnt_opts(sb, opts, 0, NULL); | ||
| 866 | } | ||
| 867 | |||
| 868 | /** | ||
| 869 | * smack_sb_statfs - Smack check on statfs | 855 | * smack_sb_statfs - Smack check on statfs |
| 870 | * @dentry: identifies the file system in question | 856 | * @dentry: identifies the file system in question |
| 871 | * | 857 | * |
| @@ -4652,7 +4638,6 @@ static struct security_hook_list smack_hooks[] __lsm_ro_after_init = { | |||
| 4652 | LSM_HOOK_INIT(sb_alloc_security, smack_sb_alloc_security), | 4638 | LSM_HOOK_INIT(sb_alloc_security, smack_sb_alloc_security), |
| 4653 | LSM_HOOK_INIT(sb_free_security, smack_sb_free_security), | 4639 | LSM_HOOK_INIT(sb_free_security, smack_sb_free_security), |
| 4654 | LSM_HOOK_INIT(sb_copy_data, smack_sb_copy_data), | 4640 | LSM_HOOK_INIT(sb_copy_data, smack_sb_copy_data), |
| 4655 | LSM_HOOK_INIT(sb_kern_mount, smack_sb_kern_mount), | ||
| 4656 | LSM_HOOK_INIT(sb_statfs, smack_sb_statfs), | 4641 | LSM_HOOK_INIT(sb_statfs, smack_sb_statfs), |
| 4657 | LSM_HOOK_INIT(sb_set_mnt_opts, smack_set_mnt_opts), | 4642 | LSM_HOOK_INIT(sb_set_mnt_opts, smack_set_mnt_opts), |
| 4658 | LSM_HOOK_INIT(sb_parse_opts_str, smack_parse_opts_str), | 4643 | LSM_HOOK_INIT(sb_parse_opts_str, smack_parse_opts_str), |
