@@ -75,7 +75,6 @@ struct selinux_fs_info {
7575 unsigned long last_class_ino ;
7676 bool policy_opened ;
7777 struct dentry * policycap_dir ;
78- struct mutex mutex ;
7978 unsigned long last_ino ;
8079 struct selinux_state * state ;
8180 struct super_block * sb ;
@@ -89,7 +88,6 @@ static int selinux_fs_info_create(struct super_block *sb)
8988 if (!fsi )
9089 return - ENOMEM ;
9190
92- mutex_init (& fsi -> mutex );
9391 fsi -> last_ino = SEL_INO_NEXT - 1 ;
9492 fsi -> state = & selinux_state ;
9593 fsi -> sb = sb ;
@@ -400,7 +398,7 @@ static int sel_open_policy(struct inode *inode, struct file *filp)
400398
401399 BUG_ON (filp -> private_data );
402400
403- mutex_lock (& fsi -> mutex );
401+ mutex_lock (& fsi -> state -> policy_mutex );
404402
405403 rc = avc_has_perm (& selinux_state ,
406404 current_sid (), SECINITSID_SECURITY ,
@@ -431,11 +429,11 @@ static int sel_open_policy(struct inode *inode, struct file *filp)
431429
432430 filp -> private_data = plm ;
433431
434- mutex_unlock (& fsi -> mutex );
432+ mutex_unlock (& fsi -> state -> policy_mutex );
435433
436434 return 0 ;
437435err :
438- mutex_unlock (& fsi -> mutex );
436+ mutex_unlock (& fsi -> state -> policy_mutex );
439437
440438 if (plm )
441439 vfree (plm -> data );
@@ -622,7 +620,7 @@ static ssize_t sel_write_load(struct file *file, const char __user *buf,
622620 ssize_t length ;
623621 void * data = NULL ;
624622
625- mutex_lock (& fsi -> mutex );
623+ mutex_lock (& fsi -> state -> policy_mutex );
626624
627625 length = avc_has_perm (& selinux_state ,
628626 current_sid (), SECINITSID_SECURITY ,
@@ -666,7 +664,7 @@ static ssize_t sel_write_load(struct file *file, const char __user *buf,
666664 from_kuid (& init_user_ns , audit_get_loginuid (current )),
667665 audit_get_sessionid (current ));
668666out :
669- mutex_unlock (& fsi -> mutex );
667+ mutex_unlock (& fsi -> state -> policy_mutex );
670668 vfree (data );
671669 return length ;
672670}
@@ -1271,7 +1269,7 @@ static ssize_t sel_read_bool(struct file *filep, char __user *buf,
12711269 unsigned index = file_inode (filep )-> i_ino & SEL_INO_MASK ;
12721270 const char * name = filep -> f_path .dentry -> d_name .name ;
12731271
1274- mutex_lock (& fsi -> mutex );
1272+ mutex_lock (& fsi -> state -> policy_mutex );
12751273
12761274 ret = - EINVAL ;
12771275 if (index >= fsi -> bool_num || strcmp (name ,
@@ -1290,14 +1288,14 @@ static ssize_t sel_read_bool(struct file *filep, char __user *buf,
12901288 }
12911289 length = scnprintf (page , PAGE_SIZE , "%d %d" , cur_enforcing ,
12921290 fsi -> bool_pending_values [index ]);
1293- mutex_unlock (& fsi -> mutex );
1291+ mutex_unlock (& fsi -> state -> policy_mutex );
12941292 ret = simple_read_from_buffer (buf , count , ppos , page , length );
12951293out_free :
12961294 free_page ((unsigned long )page );
12971295 return ret ;
12981296
12991297out_unlock :
1300- mutex_unlock (& fsi -> mutex );
1298+ mutex_unlock (& fsi -> state -> policy_mutex );
13011299 goto out_free ;
13021300}
13031301
@@ -1322,7 +1320,7 @@ static ssize_t sel_write_bool(struct file *filep, const char __user *buf,
13221320 if (IS_ERR (page ))
13231321 return PTR_ERR (page );
13241322
1325- mutex_lock (& fsi -> mutex );
1323+ mutex_lock (& fsi -> state -> policy_mutex );
13261324
13271325 length = avc_has_perm (& selinux_state ,
13281326 current_sid (), SECINITSID_SECURITY ,
@@ -1347,7 +1345,7 @@ static ssize_t sel_write_bool(struct file *filep, const char __user *buf,
13471345 length = count ;
13481346
13491347out :
1350- mutex_unlock (& fsi -> mutex );
1348+ mutex_unlock (& fsi -> state -> policy_mutex );
13511349 kfree (page );
13521350 return length ;
13531351}
@@ -1378,7 +1376,7 @@ static ssize_t sel_commit_bools_write(struct file *filep,
13781376 if (IS_ERR (page ))
13791377 return PTR_ERR (page );
13801378
1381- mutex_lock (& fsi -> mutex );
1379+ mutex_lock (& fsi -> state -> policy_mutex );
13821380
13831381 length = avc_has_perm (& selinux_state ,
13841382 current_sid (), SECINITSID_SECURITY ,
@@ -1400,7 +1398,7 @@ static ssize_t sel_commit_bools_write(struct file *filep,
14001398 length = count ;
14011399
14021400out :
1403- mutex_unlock (& fsi -> mutex );
1401+ mutex_unlock (& fsi -> state -> policy_mutex );
14041402 kfree (page );
14051403 return length ;
14061404}
0 commit comments