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
Kirill Smelkov
linux
Commits
e34d657f
Commit
e34d657f
authored
Feb 09, 2021
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
openpromfs: don't do unlock_new_inode() until the new inode is set up
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
a612c07d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
34 deletions
+33
-34
fs/openpromfs/inode.c
fs/openpromfs/inode.c
+33
-34
No files found.
fs/openpromfs/inode.c
View file @
e34d657f
...
...
@@ -236,27 +236,31 @@ static struct dentry *openpromfs_lookup(struct inode *dir, struct dentry *dentry
mutex_unlock
(
&
op_mutex
);
if
(
IS_ERR
(
inode
))
return
ERR_CAST
(
inode
);
ent_oi
=
OP_I
(
inode
);
ent_oi
->
type
=
ent_type
;
ent_oi
->
u
=
ent_data
;
switch
(
ent_type
)
{
case
op_inode_node
:
inode
->
i_mode
=
S_IFDIR
|
S_IRUGO
|
S_IXUGO
;
inode
->
i_op
=
&
openprom_inode_operations
;
inode
->
i_fop
=
&
openprom_operations
;
set_nlink
(
inode
,
2
);
break
;
case
op_inode_prop
:
if
(
of_node_name_eq
(
dp
,
"options"
)
&&
(
len
==
17
)
&&
!
strncmp
(
name
,
"security-password"
,
17
))
inode
->
i_mode
=
S_IFREG
|
S_IRUSR
|
S_IWUSR
;
else
inode
->
i_mode
=
S_IFREG
|
S_IRUGO
;
inode
->
i_fop
=
&
openpromfs_prop_ops
;
set_nlink
(
inode
,
1
);
inode
->
i_size
=
ent_oi
->
u
.
prop
->
length
;
break
;
if
(
inode
->
i_state
&
I_NEW
)
{
inode
->
i_mtime
=
inode
->
i_atime
=
inode
->
i_ctime
=
current_time
(
inode
);
ent_oi
=
OP_I
(
inode
);
ent_oi
->
type
=
ent_type
;
ent_oi
->
u
=
ent_data
;
switch
(
ent_type
)
{
case
op_inode_node
:
inode
->
i_mode
=
S_IFDIR
|
S_IRUGO
|
S_IXUGO
;
inode
->
i_op
=
&
openprom_inode_operations
;
inode
->
i_fop
=
&
openprom_operations
;
set_nlink
(
inode
,
2
);
break
;
case
op_inode_prop
:
if
(
of_node_name_eq
(
dp
,
"options"
)
&&
(
len
==
17
)
&&
!
strncmp
(
name
,
"security-password"
,
17
))
inode
->
i_mode
=
S_IFREG
|
S_IRUSR
|
S_IWUSR
;
else
inode
->
i_mode
=
S_IFREG
|
S_IRUGO
;
inode
->
i_fop
=
&
openpromfs_prop_ops
;
set_nlink
(
inode
,
1
);
inode
->
i_size
=
ent_oi
->
u
.
prop
->
length
;
break
;
}
unlock_new_inode
(
inode
);
}
return
d_splice_alias
(
inode
,
dentry
);
...
...
@@ -345,20 +349,9 @@ static void openprom_free_inode(struct inode *inode)
static
struct
inode
*
openprom_iget
(
struct
super_block
*
sb
,
ino_t
ino
)
{
struct
inode
*
inode
;
inode
=
iget_locked
(
sb
,
ino
);
struct
inode
*
inode
=
iget_locked
(
sb
,
ino
);
if
(
!
inode
)
return
ERR_PTR
(
-
ENOMEM
);
if
(
inode
->
i_state
&
I_NEW
)
{
inode
->
i_mtime
=
inode
->
i_atime
=
inode
->
i_ctime
=
current_time
(
inode
);
if
(
inode
->
i_ino
==
OPENPROM_ROOT_INO
)
{
inode
->
i_op
=
&
openprom_inode_operations
;
inode
->
i_fop
=
&
openprom_operations
;
inode
->
i_mode
=
S_IFDIR
|
S_IRUGO
|
S_IXUGO
;
}
unlock_new_inode
(
inode
);
}
inode
=
ERR_PTR
(
-
ENOMEM
);
return
inode
;
}
...
...
@@ -394,9 +387,15 @@ static int openprom_fill_super(struct super_block *s, struct fs_context *fc)
goto
out_no_root
;
}
root_inode
->
i_mtime
=
root_inode
->
i_atime
=
root_inode
->
i_ctime
=
current_time
(
root_inode
);
root_inode
->
i_op
=
&
openprom_inode_operations
;
root_inode
->
i_fop
=
&
openprom_operations
;
root_inode
->
i_mode
=
S_IFDIR
|
S_IRUGO
|
S_IXUGO
;
oi
=
OP_I
(
root_inode
);
oi
->
type
=
op_inode_node
;
oi
->
u
.
node
=
of_find_node_by_path
(
"/"
);
unlock_new_inode
(
root_inode
);
s
->
s_root
=
d_make_root
(
root_inode
);
if
(
!
s
->
s_root
)
...
...
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