Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
b9680917
Commit
b9680917
authored
Apr 11, 2016
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
security_d_instantiate(): move to the point prior to attaching dentry to inode
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
84695ffe
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
8 deletions
+7
-8
fs/dcache.c
fs/dcache.c
+7
-8
No files found.
fs/dcache.c
View file @
b9680917
...
@@ -1775,11 +1775,11 @@ void d_instantiate(struct dentry *entry, struct inode * inode)
...
@@ -1775,11 +1775,11 @@ void d_instantiate(struct dentry *entry, struct inode * inode)
{
{
BUG_ON
(
!
hlist_unhashed
(
&
entry
->
d_u
.
d_alias
));
BUG_ON
(
!
hlist_unhashed
(
&
entry
->
d_u
.
d_alias
));
if
(
inode
)
{
if
(
inode
)
{
security_d_instantiate
(
entry
,
inode
);
spin_lock
(
&
inode
->
i_lock
);
spin_lock
(
&
inode
->
i_lock
);
__d_instantiate
(
entry
,
inode
);
__d_instantiate
(
entry
,
inode
);
spin_unlock
(
&
inode
->
i_lock
);
spin_unlock
(
&
inode
->
i_lock
);
}
}
security_d_instantiate
(
entry
,
inode
);
}
}
EXPORT_SYMBOL
(
d_instantiate
);
EXPORT_SYMBOL
(
d_instantiate
);
...
@@ -1796,6 +1796,7 @@ int d_instantiate_no_diralias(struct dentry *entry, struct inode *inode)
...
@@ -1796,6 +1796,7 @@ int d_instantiate_no_diralias(struct dentry *entry, struct inode *inode)
{
{
BUG_ON
(
!
hlist_unhashed
(
&
entry
->
d_u
.
d_alias
));
BUG_ON
(
!
hlist_unhashed
(
&
entry
->
d_u
.
d_alias
));
security_d_instantiate
(
entry
,
inode
);
spin_lock
(
&
inode
->
i_lock
);
spin_lock
(
&
inode
->
i_lock
);
if
(
S_ISDIR
(
inode
->
i_mode
)
&&
!
hlist_empty
(
&
inode
->
i_dentry
))
{
if
(
S_ISDIR
(
inode
->
i_mode
)
&&
!
hlist_empty
(
&
inode
->
i_dentry
))
{
spin_unlock
(
&
inode
->
i_lock
);
spin_unlock
(
&
inode
->
i_lock
);
...
@@ -1804,7 +1805,6 @@ int d_instantiate_no_diralias(struct dentry *entry, struct inode *inode)
...
@@ -1804,7 +1805,6 @@ int d_instantiate_no_diralias(struct dentry *entry, struct inode *inode)
}
}
__d_instantiate
(
entry
,
inode
);
__d_instantiate
(
entry
,
inode
);
spin_unlock
(
&
inode
->
i_lock
);
spin_unlock
(
&
inode
->
i_lock
);
security_d_instantiate
(
entry
,
inode
);
return
0
;
return
0
;
}
}
...
@@ -1878,6 +1878,7 @@ static struct dentry *__d_obtain_alias(struct inode *inode, int disconnected)
...
@@ -1878,6 +1878,7 @@ static struct dentry *__d_obtain_alias(struct inode *inode, int disconnected)
goto
out_iput
;
goto
out_iput
;
}
}
security_d_instantiate
(
tmp
,
inode
);
spin_lock
(
&
inode
->
i_lock
);
spin_lock
(
&
inode
->
i_lock
);
res
=
__d_find_any_alias
(
inode
);
res
=
__d_find_any_alias
(
inode
);
if
(
res
)
{
if
(
res
)
{
...
@@ -1900,13 +1901,10 @@ static struct dentry *__d_obtain_alias(struct inode *inode, int disconnected)
...
@@ -1900,13 +1901,10 @@ static struct dentry *__d_obtain_alias(struct inode *inode, int disconnected)
hlist_bl_unlock
(
&
tmp
->
d_sb
->
s_anon
);
hlist_bl_unlock
(
&
tmp
->
d_sb
->
s_anon
);
spin_unlock
(
&
tmp
->
d_lock
);
spin_unlock
(
&
tmp
->
d_lock
);
spin_unlock
(
&
inode
->
i_lock
);
spin_unlock
(
&
inode
->
i_lock
);
security_d_instantiate
(
tmp
,
inode
);
return
tmp
;
return
tmp
;
out_iput:
out_iput:
if
(
res
&&
!
IS_ERR
(
res
))
security_d_instantiate
(
res
,
inode
);
iput
(
inode
);
iput
(
inode
);
return
res
;
return
res
;
}
}
...
@@ -2372,7 +2370,6 @@ static inline void __d_add(struct dentry *dentry, struct inode *inode)
...
@@ -2372,7 +2370,6 @@ static inline void __d_add(struct dentry *dentry, struct inode *inode)
__d_instantiate
(
dentry
,
inode
);
__d_instantiate
(
dentry
,
inode
);
spin_unlock
(
&
inode
->
i_lock
);
spin_unlock
(
&
inode
->
i_lock
);
}
}
security_d_instantiate
(
dentry
,
inode
);
d_rehash
(
dentry
);
d_rehash
(
dentry
);
}
}
...
@@ -2387,8 +2384,10 @@ static inline void __d_add(struct dentry *dentry, struct inode *inode)
...
@@ -2387,8 +2384,10 @@ static inline void __d_add(struct dentry *dentry, struct inode *inode)
void
d_add
(
struct
dentry
*
entry
,
struct
inode
*
inode
)
void
d_add
(
struct
dentry
*
entry
,
struct
inode
*
inode
)
{
{
if
(
inode
)
if
(
inode
)
{
security_d_instantiate
(
entry
,
inode
);
spin_lock
(
&
inode
->
i_lock
);
spin_lock
(
&
inode
->
i_lock
);
}
__d_add
(
entry
,
inode
);
__d_add
(
entry
,
inode
);
}
}
EXPORT_SYMBOL
(
d_add
);
EXPORT_SYMBOL
(
d_add
);
...
@@ -2782,6 +2781,7 @@ struct dentry *d_splice_alias(struct inode *inode, struct dentry *dentry)
...
@@ -2782,6 +2781,7 @@ struct dentry *d_splice_alias(struct inode *inode, struct dentry *dentry)
if
(
!
inode
)
if
(
!
inode
)
goto
out
;
goto
out
;
security_d_instantiate
(
dentry
,
inode
);
spin_lock
(
&
inode
->
i_lock
);
spin_lock
(
&
inode
->
i_lock
);
if
(
S_ISDIR
(
inode
->
i_mode
))
{
if
(
S_ISDIR
(
inode
->
i_mode
))
{
struct
dentry
*
new
=
__d_find_any_alias
(
inode
);
struct
dentry
*
new
=
__d_find_any_alias
(
inode
);
...
@@ -2809,7 +2809,6 @@ struct dentry *d_splice_alias(struct inode *inode, struct dentry *dentry)
...
@@ -2809,7 +2809,6 @@ struct dentry *d_splice_alias(struct inode *inode, struct dentry *dentry)
}
else
{
}
else
{
__d_move
(
new
,
dentry
,
false
);
__d_move
(
new
,
dentry
,
false
);
write_sequnlock
(
&
rename_lock
);
write_sequnlock
(
&
rename_lock
);
security_d_instantiate
(
new
,
inode
);
}
}
iput
(
inode
);
iput
(
inode
);
return
new
;
return
new
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment