git: 4d59b790553e - main - linux(4): Return ENODATA from getxattr syscalls instead of EPERM

From: Dmitry Chagin <dchagin_at_FreeBSD.org>
Date: Fri, 01 Sep 2023 08:14:40 UTC
The branch main has been updated by dchagin:

URL: https://cgit.FreeBSD.org/src/commit/?id=4d59b790553ef75b9a4b6a673eab3354f3d012b3

commit 4d59b790553ef75b9a4b6a673eab3354f3d012b3
Author:     Dmitry Chagin <dchagin@FreeBSD.org>
AuthorDate: 2023-09-01 08:10:12 +0000
Commit:     Dmitry Chagin <dchagin@FreeBSD.org>
CommitDate: 2023-09-01 08:10:12 +0000

    linux(4): Return ENODATA from getxattr syscalls instead of EPERM
    
    On Linux ENODATA mean the named attribute does not exist, or the
    process has no access to this attribute.
    
    Reported by:            zirias
    Tested by:              zirias
    MFC after:              1 week
---
 sys/compat/linux/linux_xattr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/compat/linux/linux_xattr.c b/sys/compat/linux/linux_xattr.c
index 901123684154..b9717c62133c 100644
--- a/sys/compat/linux/linux_xattr.c
+++ b/sys/compat/linux/linux_xattr.c
@@ -285,7 +285,7 @@ getxattr(struct thread *td, struct getxattr_args *args)
 	else
 		error = kern_extattr_get_fd(td, args->fd, attrnamespace,
 		    attrname, args->value, args->size);
-	return (error);
+	return (error == EPERM ? ENOATTR : error);
 }
 
 int