Bug 5745 - listxattr wrongly reports ERANGE in some cases
Summary: listxattr wrongly reports ERANGE in some cases
Status: CLOSED PATCH_ALREADY_AVAILABLE
Alias: None
Product: File System
Classification: Unclassified
Component: VFS (show other bugs)
Hardware: i386 Linux
: P2 low
Assignee: fs_vfs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-12-14 16:10 UTC by Iustin Pop
Modified: 2005-12-15 09:33 UTC (History)
0 users

See Also:
Kernel Version: 2.6.14
Subsystem:
Regression: ---
Bisected commit-id:


Attachments

Description Iustin Pop 2005-12-14 16:10:19 UTC
When doing a listxattr on an inode which does not have i_op->listxattr defined
and you are giving the exact number of bytes required, the code wrongly
considers this value too small and instead returns ERANGE.

The bug was introduced in 2.6.14, I believe with:
 diff --git a/fs/xattr.c b/fs/xattr.c
 index 6acd5c6..3f9c64b 100644
in which the test in the fs/xattr.c file, line 246, is as follows:
        if (size && error >= size)
            error = -ERANGE;
However, the 'real' filesystems do the test only with >, since the 'error'
parameter is what is returned by this function and thus, when passed back as
'size', it should be accepted.

Fix: change the comparison to '>' only.

Regards,
Iustin Pop
Comment 1 Iustin Pop 2005-12-15 09:33:30 UTC
It seems it was fixed in 2.6.14.4. Thanks!

Note You need to log in before you can comment on or make changes to this bug.