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
097787a6
Commit
097787a6
authored
Jul 07, 2004
by
Dave Kleikamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
JFS: Check for dmap corruption before using leafidx
Signed-off-by:
Dave Kleikamp
<
shaggy@austin.ibm.com
>
parent
13181061
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
0 deletions
+34
-0
fs/jfs/jfs_dmap.c
fs/jfs/jfs_dmap.c
+34
-0
No files found.
fs/jfs/jfs_dmap.c
View file @
097787a6
...
...
@@ -1204,6 +1204,12 @@ static int dbAllocNext(struct bmap * bmp, struct dmap * dp, s64 blkno,
s8
*
leaf
;
u32
mask
;
if
(
dp
->
tree
.
leafidx
!=
cpu_to_le32
(
LEAFIND
))
{
jfs_error
(
bmp
->
db_ipbmap
->
i_sb
,
"dbAllocNext: Corrupt dmap page"
);
return
-
EIO
;
}
/* pick up a pointer to the leaves of the dmap tree.
*/
leaf
=
dp
->
tree
.
stree
+
le32_to_cpu
(
dp
->
tree
.
leafidx
);
...
...
@@ -1327,6 +1333,13 @@ dbAllocNear(struct bmap * bmp,
struct
dmap
*
dp
,
s64
blkno
,
int
nblocks
,
int
l2nb
,
s64
*
results
)
{
int
word
,
lword
,
rc
;
if
(
dp
->
tree
.
leafidx
!=
cpu_to_le32
(
LEAFIND
))
{
jfs_error
(
bmp
->
db_ipbmap
->
i_sb
,
"dbAllocNear: Corrupt dmap page"
);
return
-
EIO
;
}
s8
*
leaf
=
dp
->
tree
.
stree
+
le32_to_cpu
(
dp
->
tree
.
leafidx
);
/* determine the word within the dmap that holds the hint
...
...
@@ -1489,6 +1502,13 @@ dbAllocAG(struct bmap * bmp, int agno, s64 nblocks, int l2nb, s64 * results)
dcp
=
(
struct
dmapctl
*
)
mp
->
data
;
budmin
=
dcp
->
budmin
;
if
(
dcp
->
leafidx
!=
cpu_to_le32
(
CTLLEAFIND
))
{
jfs_error
(
bmp
->
db_ipbmap
->
i_sb
,
"dbAllocAG: Corrupt dmapctl page"
);
release_metapage
(
mp
);
return
-
EIO
;
}
/* search the subtree(s) of the dmap control page that describes
* the allocation group, looking for sufficient free space. to begin,
* determine how many allocation groups are represented in a dmap
...
...
@@ -1697,6 +1717,13 @@ static int dbFindCtl(struct bmap * bmp, int l2nb, int level, s64 * blkno)
dcp
=
(
struct
dmapctl
*
)
mp
->
data
;
budmin
=
dcp
->
budmin
;
if
(
dcp
->
leafidx
!=
cpu_to_le32
(
CTLLEAFIND
))
{
jfs_error
(
bmp
->
db_ipbmap
->
i_sb
,
"dbFindCtl: Corrupt dmapctl page"
);
release_metapage
(
mp
);
return
-
EIO
;
}
/* search the tree within the dmap control page for
* sufficent free space. if sufficient free space is found,
* dbFindLeaf() returns the index of the leaf at which
...
...
@@ -2459,6 +2486,13 @@ dbAdjCtl(struct bmap * bmp, s64 blkno, int newval, int alloc, int level)
return
-
EIO
;
dcp
=
(
struct
dmapctl
*
)
mp
->
data
;
if
(
dcp
->
leafidx
!=
cpu_to_le32
(
CTLLEAFIND
))
{
jfs_error
(
bmp
->
db_ipbmap
->
i_sb
,
"dbAdjCtl: Corrupt dmapctl page"
);
release_metapage
(
mp
);
return
-
EIO
;
}
/* determine the leaf number corresponding to the block and
* the index within the dmap control tree.
*/
...
...
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