diff options
| author | Mark Brown <broonie@kernel.org> | 2024-06-03 14:45:04 +0300 |
|---|---|---|
| committer | Mark Brown <broonie@kernel.org> | 2024-06-03 14:45:04 +0300 |
| commit | 4ac0f06ca044e3ca938681a0eeb7d52a68b0b30f (patch) | |
| tree | 9433afff899211152ff78ed38f9a70ab2bb497fc /security | |
| parent | 34864c05a54d1bc544c8c3939aababbc481d99e3 (diff) | |
| parent | c3f38fa61af77b49866b006939479069cd451173 (diff) | |
| download | linux-4ac0f06ca044e3ca938681a0eeb7d52a68b0b30f.tar.xz | |
ASoC: Merge up fixes
We need this to get the i.MX platforms working in CI again.
Diffstat (limited to 'security')
| -rw-r--r-- | security/landlock/fs.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/security/landlock/fs.c b/security/landlock/fs.c index 22d8b7c28074..7877a64cc6b8 100644 --- a/security/landlock/fs.c +++ b/security/landlock/fs.c @@ -1110,6 +1110,7 @@ static int current_check_refer_path(struct dentry *const old_dentry, bool allow_parent1, allow_parent2; access_mask_t access_request_parent1, access_request_parent2; struct path mnt_dir; + struct dentry *old_parent; layer_mask_t layer_masks_parent1[LANDLOCK_NUM_ACCESS_FS] = {}, layer_masks_parent2[LANDLOCK_NUM_ACCESS_FS] = {}; @@ -1157,9 +1158,17 @@ static int current_check_refer_path(struct dentry *const old_dentry, mnt_dir.mnt = new_dir->mnt; mnt_dir.dentry = new_dir->mnt->mnt_root; + /* + * old_dentry may be the root of the common mount point and + * !IS_ROOT(old_dentry) at the same time (e.g. with open_tree() and + * OPEN_TREE_CLONE). We do not need to call dget(old_parent) because + * we keep a reference to old_dentry. + */ + old_parent = (old_dentry == mnt_dir.dentry) ? old_dentry : + old_dentry->d_parent; + /* new_dir->dentry is equal to new_dentry->d_parent */ - allow_parent1 = collect_domain_accesses(dom, mnt_dir.dentry, - old_dentry->d_parent, + allow_parent1 = collect_domain_accesses(dom, mnt_dir.dentry, old_parent, &layer_masks_parent1); allow_parent2 = collect_domain_accesses( dom, mnt_dir.dentry, new_dir->dentry, &layer_masks_parent2); |
