From 230b8c1a7b388ac5e06549a7dbe083568875804e Mon Sep 17 00:00:00 2001 From: Zhang Zhen Date: Mon, 12 May 2014 09:57:59 -0400 Subject: 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 Signed-off-by: "Theodore Ts'o" --- fs/ext4/xattr.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'fs/ext4') diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c index 4eec399ec80..c6ae6fab99b 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, { int error; + if (strlen(name) > 255) + return -ERANGE; + down_read(&EXT4_I(inode)->xattr_sem); error = ext4_xattr_ibody_get(inode, name_index, name, buffer, buffer_size); -- cgit v1.2.3-70-g09d2