Re: [PATCH] llc: Return -EINPROGRESS from llc_ui_connect()

From: Jakub Kicinski

Date: Mon Apr 20 2026 - 14:42:19 EST


On Wed, 15 Apr 2026 09:34:57 +0300 Ernestas Kulik wrote:
> Given a zero sk_sndtimeo, llc_ui_connect() skips waiting for state
> change and returns 0, confusing userspace applications that will assume
> the socket is connected, making e.g. getpeername() calls error out.
>
> Set rc to -EINPROGRESS before considering blocking, akin to AF_INET
> sockets.

Please add a note on how you discovered this issue.
Including whether you're actively using this code or just scanning it
for bugs.

> diff --git a/net/llc/af_llc.c b/net/llc/af_llc.c
> index 59d593bb5d18..9317d092ba84 100644
> --- a/net/llc/af_llc.c
> +++ b/net/llc/af_llc.c
> @@ -515,10 +515,12 @@ static int llc_ui_connect(struct socket *sock, struct sockaddr_unsized *uaddr,
> sock->state = SS_UNCONNECTED;
> sk->sk_state = TCP_CLOSE;
> goto out;
> }
>
> + rc = -EINPROGRESS;

Isn't this a bit of an odd placement? ..

> if (sk->sk_state == TCP_SYN_SENT) {
> const long timeo = sock_sndtimeo(sk, flags & O_NONBLOCK);
>
> if (!timeo || !llc_ui_wait_for_conn(sk, timeo))
> goto out;

.. I suspect you mean to target this branch, right?