Re: [PATCH] llc: Return -EINPROGRESS from llc_ui_connect()
From: Ernestas Kulik
Date: Tue Apr 21 2026 - 01:48:37 EST
On 2026-04-20 21:41, Jakub Kicinski wrote:
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.
Will do. It was discovered while adding support for AF_LLC sockets in libcoap, the usual code path for client connections was failing due to this specific issue, so I figured the behavior should be analogous to AF_INET.
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?
I can’t remember now why I put it there, but you’re right, that would be the better place.