diff options
author | Paulo Alcantara <palcantara@suse.de> | 2018-05-04 10:25:26 -0400 |
---|---|---|
committer | Steve French <smfrench@gmail.com> | 2018-05-09 12:48:42 -0400 |
commit | ae2cd7fb478b8da707906ee1706ae1379968a8f9 (patch) | |
tree | 1884c6ee363e9f0067ba11f791744e2767f25076 | |
parent | f7c439668a291ca94f358e44d3a3e9f2a2524b8a (diff) |
cifs: smb2ops: Fix listxattr() when there are no EAs
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>
-rw-r--r-- | fs/cifs/smb2ops.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c index b76b85881dcc..9c6d95ffca97 100644 --- a/fs/cifs/smb2ops.c +++ b/fs/cifs/smb2ops.c | |||
@@ -589,9 +589,15 @@ smb2_query_eas(const unsigned int xid, struct cifs_tcon *tcon, | |||
589 | 589 | ||
590 | SMB2_close(xid, tcon, fid.persistent_fid, fid.volatile_fid); | 590 | SMB2_close(xid, tcon, fid.persistent_fid, fid.volatile_fid); |
591 | 591 | ||
592 | /* | ||
593 | * If ea_name is NULL (listxattr) and there are no EAs, return 0 as it's | ||
594 | * not an error. Otherwise, the specified ea_name was not found. | ||
595 | */ | ||
592 | if (!rc) | 596 | if (!rc) |
593 | rc = move_smb2_ea_to_cifs(ea_data, buf_size, smb2_data, | 597 | rc = move_smb2_ea_to_cifs(ea_data, buf_size, smb2_data, |
594 | SMB2_MAX_EA_BUF, ea_name); | 598 | SMB2_MAX_EA_BUF, ea_name); |
599 | else if (!ea_name && rc == -ENODATA) | ||
600 | rc = 0; | ||
595 | 601 | ||
596 | kfree(smb2_data); | 602 | kfree(smb2_data); |
597 | return rc; | 603 | return rc; |