linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] SO_ZEROCOPY should rather return -ENOPROTOOPT
@ 2022-03-01 14:44 Samuel Thibault
  2022-03-01 14:51 ` Willem de Bruijn
  0 siblings, 1 reply; 9+ messages in thread
From: Samuel Thibault @ 2022-03-01 14:44 UTC (permalink / raw)
  To: willemb; +Cc: davem, kuba, linux-kernel

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@labri.fr>

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)

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2022-03-07 16:04 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-01 14:44 [PATCH] SO_ZEROCOPY should rather return -ENOPROTOOPT Samuel Thibault
2022-03-01 14:51 ` Willem de Bruijn
2022-03-01 15:00   ` Samuel Thibault
2022-03-01 15:14     ` Willem de Bruijn
2022-03-01 15:20       ` Samuel Thibault
2022-03-01 15:21         ` Willem de Bruijn
2022-03-01 15:25           ` Samuel Thibault
2022-03-06 19:22           ` Samuel Thibault
2022-03-07 16:03             ` Willem de Bruijn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).