]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
cifs: smb2ops: Fix listxattr() when there are no EAs
authorPaulo Alcantara <palcantara@suse.de>
Fri, 4 May 2018 14:25:26 +0000 (11:25 -0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 20 Jun 2018 19:01:39 +0000 (04:01 +0900)
commit6e2daada467e845e3927c030f394d0b204bbb08f
tree5a2c828e57b3dc5c2d568ef53da52bd3d6253128
parentdbb2f7b3c978e9c233cb6186350cf8abd09919e2
cifs: smb2ops: Fix listxattr() when there are no EAs

[ Upstream commit ae2cd7fb478b8da707906ee1706ae1379968a8f9 ]

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: Paulo Alcantara <palcantara@suse.de>
Reviewed-by: Aurelien Aptel <aaptel@suse.com>
Signed-off-by: Steve French <smfrench@gmail.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/cifs/smb2ops.c