• Paulo Alcantara's avatar
    cifs: smb2ops: Fix listxattr() when there are no EAs · ae2cd7fb
    Paulo Alcantara authored
    As per listxattr(2):
    
           On success, a nonnegative number is returned indicating the size
           of the extended attribute name list.  On failure, -1 is returned
           and errno  is set appropriately.
    
    In SMB1, when the server returns an empty EA list through a listxattr(),
    it will correctly return 0 as there are no EAs for the given file.
    
    However, in SMB2+, it returns -ENODATA in listxattr() which is wrong since
    the request and response were sent successfully, although there's no actual
    EA for the given file.
    
    This patch fixes listxattr() for SMB2+ by returning 0 in cifs_listxattr()
    when the server returns an empty list of EAs.
    Signed-off-by: default avatarPaulo Alcantara <palcantara@suse.de>
    Reviewed-by: default avatarAurelien Aptel <aaptel@suse.com>
    Signed-off-by: default avatarSteve French <smfrench@gmail.com>
    ae2cd7fb
smb2ops.c 92.5 KB