[PATCH] SO_ZEROCOPY should rather return -ENOPROTOOPT
From: Samuel Thibault
Date: Tue Mar 01 2022 - 09:53:32 EST
ENOTSUPP is documented as "should never be seen by user programs", and
is not exposed in <errno.h>, so applications cannot safely check against
it. We should rather return the well-known -ENOPROTOOPT.
Signed-off-by: Samuel Thibault <samuel.thibault@xxxxxxxx>
diff --git a/net/core/sock.c b/net/core/sock.c
index 4ff806d71921..6e5b84194d56 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -1377,9 +1377,9 @@ int sock_setsockopt(struct socket *sock, int level, int optname,
if (!(sk_is_tcp(sk) ||
(sk->sk_type == SOCK_DGRAM &&
sk->sk_protocol == IPPROTO_UDP)))
- ret = -ENOTSUPP;
+ ret = -ENOPROTOOPT;
} else if (sk->sk_family != PF_RDS) {
- ret = -ENOTSUPP;
+ ret = -ENOPROTOOPT;
}
if (!ret) {
if (val < 0 || val > 1)