* [PATCH] llc: Return -EINPROGRESS from llc_ui_connect()
@ 2026-04-15 6:34 Ernestas Kulik
2026-04-20 18:41 ` Jakub Kicinski
0 siblings, 1 reply; 2+ messages in thread
From: Ernestas Kulik @ 2026-04-15 6:34 UTC (permalink / raw)
To: netdev; +Cc: linux-kernel, Ernestas Kulik
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.
Signed-off-by: Ernestas Kulik <ernestas.k@iconn-networks.com>
---
net/llc/af_llc.c | 2 ++
1 file changed, 2 insertions(+)
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;
+
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;
--
2.53.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] llc: Return -EINPROGRESS from llc_ui_connect()
2026-04-15 6:34 [PATCH] llc: Return -EINPROGRESS from llc_ui_connect() Ernestas Kulik
@ 2026-04-20 18:41 ` Jakub Kicinski
0 siblings, 0 replies; 2+ messages in thread
From: Jakub Kicinski @ 2026-04-20 18:41 UTC (permalink / raw)
To: Ernestas Kulik; +Cc: netdev, linux-kernel
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?
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-04-20 18:41 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-15 6:34 [PATCH] llc: Return -EINPROGRESS from llc_ui_connect() Ernestas Kulik
2026-04-20 18:41 ` Jakub Kicinski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox