Skip to content

Commit 3d04c92

Browse files
committed
Smack - Fix build error with bringup unconfigured
The changes for mounting binary filesystems was allied improperly, with the list of tokens being in an ifdef that it shouldn't have been. Fix that, and a couple style issues that were bothering me. Reported-by: Jim Davis <[email protected]> Signed-off-by: Casey Schaufler <[email protected]>
1 parent 41a2d57 commit 3d04c92

File tree

1 file changed

+18
-14
lines changed

1 file changed

+18
-14
lines changed

security/smack/smack_lsm.c

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,7 @@ LIST_HEAD(smk_ipv6_port_list);
5757
static struct kmem_cache *smack_inode_cache;
5858
int smack_enabled;
5959

60-
#ifdef CONFIG_SECURITY_SMACK_BRINGUP
61-
static char *smk_bu_mess[] = {
62-
"Bringup Error", /* Unused */
63-
"Bringup", /* SMACK_BRINGUP_ALLOW */
64-
"Unconfined Subject", /* SMACK_UNCONFINED_SUBJECT */
65-
"Unconfined Object", /* SMACK_UNCONFINED_OBJECT */
66-
};
67-
68-
static const match_table_t tokens = {
60+
static const match_table_t smk_mount_tokens = {
6961
{Opt_fsdefault, SMK_FSDEFAULT "%s"},
7062
{Opt_fsfloor, SMK_FSFLOOR "%s"},
7163
{Opt_fshat, SMK_FSHAT "%s"},
@@ -74,6 +66,14 @@ static const match_table_t tokens = {
7466
{Opt_error, NULL},
7567
};
7668

69+
#ifdef CONFIG_SECURITY_SMACK_BRINGUP
70+
static char *smk_bu_mess[] = {
71+
"Bringup Error", /* Unused */
72+
"Bringup", /* SMACK_BRINGUP_ALLOW */
73+
"Unconfined Subject", /* SMACK_UNCONFINED_SUBJECT */
74+
"Unconfined Object", /* SMACK_UNCONFINED_OBJECT */
75+
};
76+
7777
static void smk_bu_mode(int mode, char *s)
7878
{
7979
int i = 0;
@@ -599,23 +599,27 @@ static int smack_parse_opts_str(char *options,
599599
struct security_mnt_opts *opts)
600600
{
601601
char *p;
602-
char *fsdefault = NULL, *fsfloor = NULL;
603-
char *fshat = NULL, *fsroot = NULL, *fstransmute = NULL;
604-
int rc = -ENOMEM, num_mnt_opts = 0;
602+
char *fsdefault = NULL;
603+
char *fsfloor = NULL;
604+
char *fshat = NULL;
605+
char *fsroot = NULL;
606+
char *fstransmute = NULL;
607+
int rc = -ENOMEM;
608+
int num_mnt_opts = 0;
609+
int token;
605610

606611
opts->num_mnt_opts = 0;
607612

608613
if (!options)
609614
return 0;
610615

611616
while ((p = strsep(&options, ",")) != NULL) {
612-
int token;
613617
substring_t args[MAX_OPT_ARGS];
614618

615619
if (!*p)
616620
continue;
617621

618-
token = match_token(p, tokens, args);
622+
token = match_token(p, smk_mount_tokens, args);
619623

620624
switch (token) {
621625
case Opt_fsdefault:

0 commit comments

Comments
 (0)