Bug 5745

Summary: listxattr wrongly reports ERANGE in some cases
Product: File System Reporter: Iustin Pop (iustin)
Component: VFSAssignee: fs_vfs
Status: CLOSED PATCH_ALREADY_AVAILABLE    
Severity: low    
Priority: P2    
Hardware: i386   
OS: Linux   
Kernel Version: 2.6.14 Subsystem:
Regression: --- Bisected commit-id:

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!