@@ -611,10 +611,11 @@ static int bad_option(struct superblock_security_struct *sbsec, char flag,
611
611
return 0 ;
612
612
}
613
613
614
- static int parse_sid (struct super_block * sb , const char * s , u32 * sid )
614
+ static int parse_sid (struct super_block * sb , const char * s , u32 * sid ,
615
+ gfp_t gfp )
615
616
{
616
617
int rc = security_context_str_to_sid (& selinux_state , s ,
617
- sid , GFP_KERNEL );
618
+ sid , gfp );
618
619
if (rc )
619
620
pr_warn ("SELinux: security_context_str_to_sid"
620
621
"(%s) failed for (dev %s, type %s) errno=%d\n" ,
@@ -685,7 +686,8 @@ static int selinux_set_mnt_opts(struct super_block *sb,
685
686
*/
686
687
if (opts ) {
687
688
if (opts -> fscontext ) {
688
- rc = parse_sid (sb , opts -> fscontext , & fscontext_sid );
689
+ rc = parse_sid (sb , opts -> fscontext , & fscontext_sid ,
690
+ GFP_KERNEL );
689
691
if (rc )
690
692
goto out ;
691
693
if (bad_option (sbsec , FSCONTEXT_MNT , sbsec -> sid ,
@@ -694,7 +696,8 @@ static int selinux_set_mnt_opts(struct super_block *sb,
694
696
sbsec -> flags |= FSCONTEXT_MNT ;
695
697
}
696
698
if (opts -> context ) {
697
- rc = parse_sid (sb , opts -> context , & context_sid );
699
+ rc = parse_sid (sb , opts -> context , & context_sid ,
700
+ GFP_KERNEL );
698
701
if (rc )
699
702
goto out ;
700
703
if (bad_option (sbsec , CONTEXT_MNT , sbsec -> mntpoint_sid ,
@@ -703,7 +706,8 @@ static int selinux_set_mnt_opts(struct super_block *sb,
703
706
sbsec -> flags |= CONTEXT_MNT ;
704
707
}
705
708
if (opts -> rootcontext ) {
706
- rc = parse_sid (sb , opts -> rootcontext , & rootcontext_sid );
709
+ rc = parse_sid (sb , opts -> rootcontext , & rootcontext_sid ,
710
+ GFP_KERNEL );
707
711
if (rc )
708
712
goto out ;
709
713
if (bad_option (sbsec , ROOTCONTEXT_MNT , root_isec -> sid ,
@@ -712,7 +716,8 @@ static int selinux_set_mnt_opts(struct super_block *sb,
712
716
sbsec -> flags |= ROOTCONTEXT_MNT ;
713
717
}
714
718
if (opts -> defcontext ) {
715
- rc = parse_sid (sb , opts -> defcontext , & defcontext_sid );
719
+ rc = parse_sid (sb , opts -> defcontext , & defcontext_sid ,
720
+ GFP_KERNEL );
716
721
if (rc )
717
722
goto out ;
718
723
if (bad_option (sbsec , DEFCONTEXT_MNT , sbsec -> def_sid ,
@@ -2702,14 +2707,14 @@ static int selinux_sb_mnt_opts_compat(struct super_block *sb, void *mnt_opts)
2702
2707
return (sbsec -> flags & SE_MNTMASK ) ? 1 : 0 ;
2703
2708
2704
2709
if (opts -> fscontext ) {
2705
- rc = parse_sid (sb , opts -> fscontext , & sid );
2710
+ rc = parse_sid (sb , opts -> fscontext , & sid , GFP_NOWAIT );
2706
2711
if (rc )
2707
2712
return 1 ;
2708
2713
if (bad_option (sbsec , FSCONTEXT_MNT , sbsec -> sid , sid ))
2709
2714
return 1 ;
2710
2715
}
2711
2716
if (opts -> context ) {
2712
- rc = parse_sid (sb , opts -> context , & sid );
2717
+ rc = parse_sid (sb , opts -> context , & sid , GFP_NOWAIT );
2713
2718
if (rc )
2714
2719
return 1 ;
2715
2720
if (bad_option (sbsec , CONTEXT_MNT , sbsec -> mntpoint_sid , sid ))
@@ -2719,14 +2724,14 @@ static int selinux_sb_mnt_opts_compat(struct super_block *sb, void *mnt_opts)
2719
2724
struct inode_security_struct * root_isec ;
2720
2725
2721
2726
root_isec = backing_inode_security (sb -> s_root );
2722
- rc = parse_sid (sb , opts -> rootcontext , & sid );
2727
+ rc = parse_sid (sb , opts -> rootcontext , & sid , GFP_NOWAIT );
2723
2728
if (rc )
2724
2729
return 1 ;
2725
2730
if (bad_option (sbsec , ROOTCONTEXT_MNT , root_isec -> sid , sid ))
2726
2731
return 1 ;
2727
2732
}
2728
2733
if (opts -> defcontext ) {
2729
- rc = parse_sid (sb , opts -> defcontext , & sid );
2734
+ rc = parse_sid (sb , opts -> defcontext , & sid , GFP_NOWAIT );
2730
2735
if (rc )
2731
2736
return 1 ;
2732
2737
if (bad_option (sbsec , DEFCONTEXT_MNT , sbsec -> def_sid , sid ))
@@ -2749,14 +2754,14 @@ static int selinux_sb_remount(struct super_block *sb, void *mnt_opts)
2749
2754
return 0 ;
2750
2755
2751
2756
if (opts -> fscontext ) {
2752
- rc = parse_sid (sb , opts -> fscontext , & sid );
2757
+ rc = parse_sid (sb , opts -> fscontext , & sid , GFP_KERNEL );
2753
2758
if (rc )
2754
2759
return rc ;
2755
2760
if (bad_option (sbsec , FSCONTEXT_MNT , sbsec -> sid , sid ))
2756
2761
goto out_bad_option ;
2757
2762
}
2758
2763
if (opts -> context ) {
2759
- rc = parse_sid (sb , opts -> context , & sid );
2764
+ rc = parse_sid (sb , opts -> context , & sid , GFP_KERNEL );
2760
2765
if (rc )
2761
2766
return rc ;
2762
2767
if (bad_option (sbsec , CONTEXT_MNT , sbsec -> mntpoint_sid , sid ))
@@ -2765,14 +2770,14 @@ static int selinux_sb_remount(struct super_block *sb, void *mnt_opts)
2765
2770
if (opts -> rootcontext ) {
2766
2771
struct inode_security_struct * root_isec ;
2767
2772
root_isec = backing_inode_security (sb -> s_root );
2768
- rc = parse_sid (sb , opts -> rootcontext , & sid );
2773
+ rc = parse_sid (sb , opts -> rootcontext , & sid , GFP_KERNEL );
2769
2774
if (rc )
2770
2775
return rc ;
2771
2776
if (bad_option (sbsec , ROOTCONTEXT_MNT , root_isec -> sid , sid ))
2772
2777
goto out_bad_option ;
2773
2778
}
2774
2779
if (opts -> defcontext ) {
2775
- rc = parse_sid (sb , opts -> defcontext , & sid );
2780
+ rc = parse_sid (sb , opts -> defcontext , & sid , GFP_KERNEL );
2776
2781
if (rc )
2777
2782
return rc ;
2778
2783
if (bad_option (sbsec , DEFCONTEXT_MNT , sbsec -> def_sid , sid ))
0 commit comments