public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCHv2] SO_ZEROCOPY should return -EOPNOTSUPP rather than -ENOTSUPP
@ 2022-03-07 22:31 Samuel Thibault
  2022-03-07 23:27 ` Willem de Bruijn
  2022-03-09  6:20 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Samuel Thibault @ 2022-03-07 22:31 UTC (permalink / raw)
  To: davem, kuba; +Cc: Willem de Bruijn, linux-kernel, Network Development

ENOTSUPP is documented as "should never be seen by user programs",
and thus not exposed in <errno.h>, and thus applications cannot safely
check against it (they get "Unknown error 524" as strerror). We should
rather return the well-known -EOPNOTSUPP.

This is similar to 2230a7ef5198 ("drop_monitor: Use correct error
code") and 4a5cdc604b9c ("net/tls: Fix return values to avoid
ENOTSUPP"), which did not seem to cause problems.

Signed-off-by: Samuel Thibault <samuel.thibault@labri.fr>

---
Difference with v1: use -EOPNOTSUPP instead of -ENOPROTOOPT.

diff --git a/net/core/sock.c b/net/core/sock.c
index 4ff806d71921..839eb076afee 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 = -EOPNOTSUPP;
 		} else if (sk->sk_family != PF_RDS) {
-			ret = -ENOTSUPP;
+			ret = -EOPNOTSUPP;
 		}
 		if (!ret) {
 			if (val < 0 || val > 1)

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

* Re: [PATCHv2] SO_ZEROCOPY should return -EOPNOTSUPP rather than -ENOTSUPP
  2022-03-07 22:31 [PATCHv2] SO_ZEROCOPY should return -EOPNOTSUPP rather than -ENOTSUPP Samuel Thibault
@ 2022-03-07 23:27 ` Willem de Bruijn
  2022-03-09  6:20 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Willem de Bruijn @ 2022-03-07 23:27 UTC (permalink / raw)
  To: Samuel Thibault, davem, kuba, Willem de Bruijn, linux-kernel,
	Network Development

On Mon, Mar 7, 2022 at 5:31 PM Samuel Thibault <samuel.thibault@labri.fr> wrote:
>
> ENOTSUPP is documented as "should never be seen by user programs",
> and thus not exposed in <errno.h>, and thus applications cannot safely
> check against it (they get "Unknown error 524" as strerror). We should
> rather return the well-known -EOPNOTSUPP.
>
> This is similar to 2230a7ef5198 ("drop_monitor: Use correct error
> code") and 4a5cdc604b9c ("net/tls: Fix return values to avoid
> ENOTSUPP"), which did not seem to cause problems.
>
> Signed-off-by: Samuel Thibault <samuel.thibault@labri.fr>

Acked-by: Willem de Bruijn <willemb@google.com>

From what I can tell, the first of the two referenced patches went to
net-next, the second one to net and stable. I would suggest only
net-next for this. Else, we should also add a Fixes tag.

Small nit, for future patches: preferred syntax is commit $SHA1
("subject"), including the commit keyword.

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

* Re: [PATCHv2] SO_ZEROCOPY should return -EOPNOTSUPP rather than -ENOTSUPP
  2022-03-07 22:31 [PATCHv2] SO_ZEROCOPY should return -EOPNOTSUPP rather than -ENOTSUPP Samuel Thibault
  2022-03-07 23:27 ` Willem de Bruijn
@ 2022-03-09  6:20 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-03-09  6:20 UTC (permalink / raw)
  To: Samuel Thibault; +Cc: davem, kuba, willemdebruijn.kernel, linux-kernel, netdev

Hello:

This patch was applied to netdev/net-next.git (master)
by Jakub Kicinski <kuba@kernel.org>:

On Mon, 7 Mar 2022 23:31:26 +0100 you wrote:
> ENOTSUPP is documented as "should never be seen by user programs",
> and thus not exposed in <errno.h>, and thus applications cannot safely
> check against it (they get "Unknown error 524" as strerror). We should
> rather return the well-known -EOPNOTSUPP.
> 
> This is similar to 2230a7ef5198 ("drop_monitor: Use correct error
> code") and 4a5cdc604b9c ("net/tls: Fix return values to avoid
> ENOTSUPP"), which did not seem to cause problems.
> 
> [...]

Here is the summary with links:
  - [PATCHv2] SO_ZEROCOPY should return -EOPNOTSUPP rather than -ENOTSUPP
    https://git.kernel.org/netdev/net-next/c/869420a8be19

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2022-03-09  6:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-07 22:31 [PATCHv2] SO_ZEROCOPY should return -EOPNOTSUPP rather than -ENOTSUPP Samuel Thibault
2022-03-07 23:27 ` Willem de Bruijn
2022-03-09  6:20 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox