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
67ef9eea
Commit
67ef9eea
authored
20 years ago
by
Alexander Viro
Committed by
Linus Torvalds
20 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] d_alloc_root() fixes: hpfs
- inode leak on d_alloc_root() failure
parent
cee63f57
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
17 deletions
+21
-17
fs/hpfs/super.c
fs/hpfs/super.c
+21
-17
No files found.
fs/hpfs/super.c
View file @
67ef9eea
...
@@ -448,6 +448,7 @@ static int hpfs_fill_super(struct super_block *s, void *options, int silent)
...
@@ -448,6 +448,7 @@ static int hpfs_fill_super(struct super_block *s, void *options, int silent)
struct
hpfs_super_block
*
superblock
;
struct
hpfs_super_block
*
superblock
;
struct
hpfs_spare_block
*
spareblock
;
struct
hpfs_spare_block
*
spareblock
;
struct
hpfs_sb_info
*
sbi
;
struct
hpfs_sb_info
*
sbi
;
struct
inode
*
root
;
uid_t
uid
;
uid_t
uid
;
gid_t
gid
;
gid_t
gid
;
...
@@ -613,10 +614,11 @@ static int hpfs_fill_super(struct super_block *s, void *options, int silent)
...
@@ -613,10 +614,11 @@ static int hpfs_fill_super(struct super_block *s, void *options, int silent)
brelse
(
bh0
);
brelse
(
bh0
);
hpfs_lock_iget
(
s
,
1
);
hpfs_lock_iget
(
s
,
1
);
s
->
s_root
=
d_alloc_root
(
iget
(
s
,
sbi
->
sb_root
)
);
root
=
iget
(
s
,
sbi
->
sb_root
);
hpfs_unlock_iget
(
s
);
hpfs_unlock_iget
(
s
);
if
(
!
s
->
s_root
||
!
s
->
s_root
->
d_inode
)
{
s
->
s_root
=
d_alloc_root
(
root
);
printk
(
"HPFS: iget failed. Why???
\n
"
);
if
(
!
s
->
s_root
)
{
iput
(
root
);
goto
bail0
;
goto
bail0
;
}
}
hpfs_set_dentry_operations
(
s
->
s_root
);
hpfs_set_dentry_operations
(
s
->
s_root
);
...
@@ -627,22 +629,24 @@ static int hpfs_fill_super(struct super_block *s, void *options, int silent)
...
@@ -627,22 +629,24 @@ static int hpfs_fill_super(struct super_block *s, void *options, int silent)
root_dno
=
hpfs_fnode_dno
(
s
,
sbi
->
sb_root
);
root_dno
=
hpfs_fnode_dno
(
s
,
sbi
->
sb_root
);
if
(
root_dno
)
if
(
root_dno
)
de
=
map_dirent
(
s
->
s_root
->
d_inode
,
root_dno
,
"
\001\001
"
,
2
,
NULL
,
&
qbh
);
de
=
map_dirent
(
root
,
root_dno
,
"
\001\001
"
,
2
,
NULL
,
&
qbh
);
if
(
!
root_dno
||
!
de
)
hpfs_error
(
s
,
"unable to find root dir"
);
if
(
!
de
)
hpfs_error
(
s
,
"unable to find root dir"
);
else
{
else
{
s
->
s_root
->
d_inode
->
i_atime
.
tv_sec
=
local_to_gmt
(
s
,
de
->
read_date
);
root
->
i_atime
.
tv_sec
=
local_to_gmt
(
s
,
de
->
read_date
);
s
->
s_root
->
d_inode
->
i_atime
.
tv_nsec
=
0
;
root
->
i_atime
.
tv_nsec
=
0
;
s
->
s_root
->
d_inode
->
i_mtime
.
tv_sec
=
local_to_gmt
(
s
,
de
->
write_date
);
root
->
i_mtime
.
tv_sec
=
local_to_gmt
(
s
,
de
->
write_date
);
s
->
s_root
->
d_inode
->
i_mtime
.
tv_nsec
=
0
;
root
->
i_mtime
.
tv_nsec
=
0
;
s
->
s_root
->
d_inode
->
i_ctime
.
tv_sec
=
local_to_gmt
(
s
,
de
->
creation_date
);
root
->
i_ctime
.
tv_sec
=
local_to_gmt
(
s
,
de
->
creation_date
);
s
->
s_root
->
d_inode
->
i_ctime
.
tv_nsec
=
0
;
root
->
i_ctime
.
tv_nsec
=
0
;
hpfs_i
(
s
->
s_root
->
d_inode
)
->
i_ea_size
=
de
->
ea_size
;
hpfs_i
(
root
)
->
i_ea_size
=
de
->
ea_size
;
hpfs_i
(
s
->
s_root
->
d_inode
)
->
i_parent_dir
=
s
->
s_root
->
d_inode
->
i_ino
;
hpfs_i
(
root
)
->
i_parent_dir
=
root
->
i_ino
;
if
(
s
->
s_root
->
d_inode
->
i_size
==
-
1
)
s
->
s_root
->
d_inode
->
i_size
=
2048
;
if
(
root
->
i_size
==
-
1
)
if
(
s
->
s_root
->
d_inode
->
i_blocks
==
-
1
)
s
->
s_root
->
d_inode
->
i_blocks
=
5
;
root
->
i_size
=
2048
;
if
(
root
->
i_blocks
==
-
1
)
root
->
i_blocks
=
5
;
hpfs_brelse4
(
&
qbh
);
}
}
if
(
de
)
hpfs_brelse4
(
&
qbh
);
return
0
;
return
0
;
bail4:
brelse
(
bh2
);
bail4:
brelse
(
bh2
);
...
...
This diff is collapsed.
Click to expand it.
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