Skip to content

Commit ce0b16d

Browse files
dhowellsAl Viro
authored andcommitted
VFS: security/: d_inode() annotations
... except where that code acts as a filesystem driver, rather than working with dentries given to it. Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent c6f493d commit ce0b16d

4 files changed

Lines changed: 12 additions & 12 deletions

File tree

‎security/apparmor/apparmorfs.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ void __aa_fs_profile_rmdir(struct aa_profile *profile)
365365
if (!profile->dents[i])
366366
continue;
367367

368-
r = profile->dents[i]->d_inode->i_private;
368+
r = d_inode(profile->dents[i])->i_private;
369369
securityfs_remove(profile->dents[i]);
370370
aa_put_replacedby(r);
371371
profile->dents[i] = NULL;

‎security/inode.c‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ static int mount_count;
2727

2828
static inline int positive(struct dentry *dentry)
2929
{
30-
return dentry->d_inode && !d_unhashed(dentry);
30+
return d_really_is_positive(dentry) && !d_unhashed(dentry);
3131
}
3232

3333
static int fill_super(struct super_block *sb, void *data, int silent)
@@ -102,14 +102,14 @@ struct dentry *securityfs_create_file(const char *name, umode_t mode,
102102
if (!parent)
103103
parent = mount->mnt_root;
104104

105-
dir = parent->d_inode;
105+
dir = d_inode(parent);
106106

107107
mutex_lock(&dir->i_mutex);
108108
dentry = lookup_one_len(name, parent, strlen(name));
109109
if (IS_ERR(dentry))
110110
goto out;
111111

112-
if (dentry->d_inode) {
112+
if (d_really_is_positive(dentry)) {
113113
error = -EEXIST;
114114
goto out1;
115115
}
@@ -197,20 +197,20 @@ void securityfs_remove(struct dentry *dentry)
197197
return;
198198

199199
parent = dentry->d_parent;
200-
if (!parent || !parent->d_inode)
200+
if (!parent || d_really_is_negative(parent))
201201
return;
202202

203-
mutex_lock(&parent->d_inode->i_mutex);
203+
mutex_lock(&d_inode(parent)->i_mutex);
204204
if (positive(dentry)) {
205-
if (dentry->d_inode) {
205+
if (d_really_is_positive(dentry)) {
206206
if (d_is_dir(dentry))
207-
simple_rmdir(parent->d_inode, dentry);
207+
simple_rmdir(d_inode(parent), dentry);
208208
else
209-
simple_unlink(parent->d_inode, dentry);
209+
simple_unlink(d_inode(parent), dentry);
210210
dput(dentry);
211211
}
212212
}
213-
mutex_unlock(&parent->d_inode->i_mutex);
213+
mutex_unlock(&d_inode(parent)->i_mutex);
214214
simple_release_fs(&mount, &mount_count);
215215
}
216216
EXPORT_SYMBOL_GPL(securityfs_remove);

‎security/selinux/selinuxfs.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1737,7 +1737,7 @@ static struct dentry *sel_make_dir(struct dentry *dir, const char *name,
17371737
inc_nlink(inode);
17381738
d_add(dentry, inode);
17391739
/* bump link count on parent directory, too */
1740-
inc_nlink(dir->d_inode);
1740+
inc_nlink(d_inode(dir));
17411741

17421742
return dentry;
17431743
}

‎security/smack/smackfs.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2395,7 +2395,7 @@ static int smk_fill_super(struct super_block *sb, void *data, int silent)
23952395
return rc;
23962396
}
23972397

2398-
root_inode = sb->s_root->d_inode;
2398+
root_inode = d_inode(sb->s_root);
23992399

24002400
return 0;
24012401
}

0 commit comments

Comments
 (0)