@@ -908,28 +908,22 @@ static bool is_access_to_paths_allowed(
908908 return allowed_parent1 && allowed_parent2 ;
909909}
910910
911- static int check_access_path (const struct landlock_ruleset * const domain ,
912- const struct path * const path ,
913- access_mask_t access_request )
914- {
915- layer_mask_t layer_masks [LANDLOCK_NUM_ACCESS_FS ] = {};
916-
917- access_request = landlock_init_layer_masks (
918- domain , access_request , & layer_masks , LANDLOCK_KEY_INODE );
919- if (is_access_to_paths_allowed (domain , path , access_request ,
920- & layer_masks , NULL , 0 , NULL , NULL ))
921- return 0 ;
922- return - EACCES ;
923- }
924-
925911static int current_check_access_path (const struct path * const path ,
926- const access_mask_t access_request )
912+ access_mask_t access_request )
927913{
928914 const struct landlock_ruleset * const dom = get_current_fs_domain ();
915+ layer_mask_t layer_masks [LANDLOCK_NUM_ACCESS_FS ] = {};
929916
930917 if (!dom )
931918 return 0 ;
932- return check_access_path (dom , path , access_request );
919+
920+ access_request = landlock_init_layer_masks (
921+ dom , access_request , & layer_masks , LANDLOCK_KEY_INODE );
922+ if (is_access_to_paths_allowed (dom , path , access_request , & layer_masks ,
923+ NULL , 0 , NULL , NULL ))
924+ return 0 ;
925+
926+ return - EACCES ;
933927}
934928
935929static __attribute_const__ access_mask_t get_mode_access (const umode_t mode )
@@ -1413,11 +1407,7 @@ static int hook_path_mknod(const struct path *const dir,
14131407 struct dentry * const dentry , const umode_t mode ,
14141408 const unsigned int dev )
14151409{
1416- const struct landlock_ruleset * const dom = get_current_fs_domain ();
1417-
1418- if (!dom )
1419- return 0 ;
1420- return check_access_path (dom , dir , get_mode_access (mode ));
1410+ return current_check_access_path (dir , get_mode_access (mode ));
14211411}
14221412
14231413static int hook_path_symlink (const struct path * const dir ,
0 commit comments