Re: [PATCH] xprtsock: Fix a loop in xs_tcp_setup_socket()
From: Jeff Layton
Date: Sat Apr 20 2024 - 07:06:29 EST
On Sat, 2024-04-20 at 19:48 +0900, Lex Siegel wrote:
> When using a bpf on kernel_connect(), the call can return -EPERM.
> This causes xs_tcp_setup_socket() to loop forever, filling up the
> syslog and causing the kernel to freeze up.
>
> Signed-off-by: Lex Siegel <usiegl00@xxxxxxxxx>
> ---
> net/sunrpc/xprtsock.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
> index bb9b747d58a1..47b254806a08 100644
> --- a/net/sunrpc/xprtsock.c
> +++ b/net/sunrpc/xprtsock.c
> @@ -2446,6 +2446,8 @@ static void xs_tcp_setup_socket(struct work_struct *work)
> /* Happens, for instance, if the user specified a link
> * local IPv6 address without a scope-id.
> */
> + case -EPERM:
> + /* Happens, for instance, if a bpf is preventing the connect */
> case -ECONNREFUSED:
> case -ECONNRESET:
> case -ENETDOWN:
Yeah, I think we'd consider -EPERM a permanent error.
Reviewed-by: Jeff Layton <jlayton@xxxxxxxxxx>