projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
fab8eef
)
xfs: sanity check inode di_mode
author
Amir Goldstein
<
[email protected]
>
Tue, 17 Jan 2017 19:41:44 +0000
(11:41 -0800)
committer
Darrick J. Wong
<
[email protected]
>
Tue, 17 Jan 2017 19:42:22 +0000
(11:42 -0800)
Check for invalid file type in xfs_dinode_verify()
and fail to load the inode structure from disk.
Reviewed-by: Darrick J. Wong <
[email protected]
>
Signed-off-by: Amir Goldstein <
[email protected]
>
Reviewed-by: Christoph Hellwig <
[email protected]
>
Reviewed-by: Darrick J. Wong <
[email protected]
>
Signed-off-by: Darrick J. Wong <
[email protected]
>
fs/xfs/libxfs/xfs_inode_buf.c
patch
|
blob
|
history
diff --git
a/fs/xfs/libxfs/xfs_inode_buf.c
b/fs/xfs/libxfs/xfs_inode_buf.c
index 0091ac3f52410cae043ef5992c2396a11b1d7a56..d93f9d918cfc11ada2ded50d21e0eb9226381f93 100644
(file)
--- a/
fs/xfs/libxfs/xfs_inode_buf.c
+++ b/
fs/xfs/libxfs/xfs_inode_buf.c
@@
-29,6
+29,7
@@
#include "xfs_icache.h"
#include "xfs_trans.h"
#include "xfs_ialloc.h"
+#include "xfs_dir2.h"
/*
* Check that none of the inode's in the buffer have a next
@@
-398,6
+399,8
@@
xfs_dinode_verify(
return false;
mode = be16_to_cpu(dip->di_mode);
+ if (mode && xfs_mode_to_ftype(mode) == XFS_DIR3_FT_UNKNOWN)
+ return false;
/* No zero-length symlinks/dirs. */
if ((S_ISLNK(mode) || S_ISDIR(mode)) && dip->di_size == 0)