diff options
author | Zhang Zhen <zhenzhang.zhang@huawei.com> | 2014-05-12 09:57:59 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2014-05-12 09:57:59 -0400 |
commit | 230b8c1a7b388ac5e06549a7dbe083568875804e (patch) | |
tree | d1291f679566ab473016a687e17c4155c7f3f6ea /fs/ext4/xattr.c | |
parent | 1c8349a17137b93f0a83f276c764a6df1b9a116e (diff) |
ext4: avoid unneeded lookup when xattr name is invalid
In ext4_xattr_set_handle() we have checked the xattr name's length. So
we should also check it in ext4_xattr_get() to avoid unneeded lookup
caused by invalid name.
Signed-off-by: Zhang Zhen <zhenzhang.zhang@huawei.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/xattr.c')
-rw-r--r-- | fs/ext4/xattr.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c index 4eec399ec807..c6ae6fab99be 100644 --- a/fs/ext4/xattr.c +++ b/fs/ext4/xattr.c | |||
@@ -369,6 +369,9 @@ ext4_xattr_get(struct inode *inode, int name_index, const char *name, | |||
369 | { | 369 | { |
370 | int error; | 370 | int error; |
371 | 371 | ||
372 | if (strlen(name) > 255) | ||
373 | return -ERANGE; | ||
374 | |||
372 | down_read(&EXT4_I(inode)->xattr_sem); | 375 | down_read(&EXT4_I(inode)->xattr_sem); |
373 | error = ext4_xattr_ibody_get(inode, name_index, name, buffer, | 376 | error = ext4_xattr_ibody_get(inode, name_index, name, buffer, |
374 | buffer_size); | 377 | buffer_size); |