History

Merge tag 'selinux-pr-20220616' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/selinux

Pull selinux fix from Paul Moore: "A single SELinux patch to fix memory leaks when mounting filesystems with SELinux mount options" * tag 'selinux-pr-20220616' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/selinux: selinux: free contexts previously transferred in selinux_add_opt()

Linus Torvalds committed 4 years ago

Commit 6decbf72 parents 48a23ec cad140d1 file · +4 −7Browse files

Unified · Split

security/selinux/hooks.c+4−7
@@ -2600,8 +2600,9 @@ static int selinux_sb_eat_lsm_opts(char *options, void **mnt_opts) · 2599 unmodified lines
2600 }2600 }
2601 }2601 }
2602 rc = selinux_add_opt(token, arg, mnt_opts);2602 rc = selinux_add_opt(token, arg, mnt_opts);
2603 kfree(arg);
2604 arg = NULL;
2603 if (unlikely(rc)) {2605 if (unlikely(rc)) {
2604 kfree(arg);
2605 goto free_opt;2606 goto free_opt;
2606 }2607 }
2607 } else {2608 } else {
@@ -2792,17 +2793,13 @@ static int selinux_fs_context_parse_param(struct fs_context *fc, · 184 unmodified lines
2792 struct fs_parameter *param)2793 struct fs_parameter *param)
2793{2794{
2794 struct fs_parse_result result;2795 struct fs_parse_result result;
2795 int opt, rc;2796 int opt;
2796 2797
2797 opt = fs_parse(fc, selinux_fs_parameters, param, &result);2798 opt = fs_parse(fc, selinux_fs_parameters, param, &result);
2798 if (opt < 0)2799 if (opt < 0)
2799 return opt;2800 return opt;
2800 2801
2801 rc = selinux_add_opt(opt, param->string, &fc->security);2802 return selinux_add_opt(opt, param->string, &fc->security);
2802 if (!rc)
2803 param->string = NULL;
2804
2805 return rc;
2806}2803}
2807 2804
2808/* inode security operations */2805/* inode security operations */