@@ -908,28 +908,22 @@ static bool is_access_to_paths_allowed(
908
908
return allowed_parent1 && allowed_parent2 ;
909
909
}
910
910
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
-
925
911
static int current_check_access_path (const struct path * const path ,
926
- const access_mask_t access_request )
912
+ access_mask_t access_request )
927
913
{
928
914
const struct landlock_ruleset * const dom = get_current_fs_domain ();
915
+ layer_mask_t layer_masks [LANDLOCK_NUM_ACCESS_FS ] = {};
929
916
930
917
if (!dom )
931
918
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 ;
933
927
}
934
928
935
929
static __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,
1413
1407
struct dentry * const dentry , const umode_t mode ,
1414
1408
const unsigned int dev )
1415
1409
{
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 ));
1421
1411
}
1422
1412
1423
1413
static int hook_path_symlink (const struct path * const dir ,
0 commit comments