All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net/tls: Fix inverted error codes to avoid endless loop
@ 2017-12-11 18:56 r.hering
  2017-12-13 18:48 ` David Miller
  0 siblings, 1 reply; 6+ messages in thread
From: r.hering @ 2017-12-11 18:56 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev

sendfile() calls can hang endless with using Kernel TLS if a socket error 
occurs.
Socket error codes must be inverted by Kernel TLS before returning because
they are stored with positive sign. If returned non-inverted they are
interpreted as number of bytes sent, causing endless looping of the
splice mechanic behind sendfile().

Signed-off-by: Robert Hering <r.hering@avm.de>
---
diff --git a/include/net/tls.h b/include/net/tls.h
index 936cfc5..9185e53 100644
--- a/include/net/tls.h
+++ b/include/net/tls.h
@@ -170,7 +170,7 @@ static inline bool tls_is_pending_open_record(struct 
tls_context *tls_ctx)
 
 static inline void tls_err_abort(struct sock *sk)
 {
-       sk->sk_err = -EBADMSG;
+       sk->sk_err = EBADMSG;
        sk->sk_error_report(sk);
 }
 
diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c
index 73d1921..9773571 100644
--- a/net/tls/tls_sw.c
+++ b/net/tls/tls_sw.c
@@ -391,7 +391,7 @@ int tls_sw_sendmsg(struct sock *sk, struct msghdr 
*msg, size_t size)
 
        while (msg_data_left(msg)) {
                if (sk->sk_err) {
-                       ret = sk->sk_err;
+                       ret = -sk->sk_err;
                        goto send_end;
                }
 
@@ -544,7 +544,7 @@ int tls_sw_sendpage(struct sock *sk, struct page 
*page,
                size_t copy, required_size;
 
                if (sk->sk_err) {
-                       ret = sk->sk_err;
+                       ret = -sk->sk_err;
                        goto sendpage_end;
                }
 

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

* Re: [PATCH] net/tls: Fix inverted error codes to avoid endless loop
  2017-12-11 18:56 [PATCH] net/tls: Fix inverted error codes to avoid endless loop r.hering
@ 2017-12-13 18:48 ` David Miller
  0 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2017-12-13 18:48 UTC (permalink / raw)
  To: r.hering; +Cc: netdev

From: r.hering@avm.de
Date: Mon, 11 Dec 2017 19:56:21 +0100

> sendfile() calls can hang endless with using Kernel TLS if a socket error 
> occurs.
> Socket error codes must be inverted by Kernel TLS before returning because
> they are stored with positive sign. If returned non-inverted they are
> interpreted as number of bytes sent, causing endless looping of the
> splice mechanic behind sendfile().
> 
> Signed-off-by: Robert Hering <r.hering@avm.de>

Your patch is corrupted by your email client, it turned TAB characters
into spaces.

Please read Documentation/email-clients.txt to fix this.

Send a test patch to yourself, and make sure you can actually apply
the patch contained in that test email.

Do not repost the patch here until you can get such a test patch
to work properly.

Thank you.

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

* Re: [PATCH] net/tls: Fix inverted error codes to avoid endless loop
  2018-01-12 14:42 r.hering
@ 2018-01-15 19:22 ` David Miller
  0 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2018-01-15 19:22 UTC (permalink / raw)
  To: r.hering; +Cc: netdev

From: r.hering@avm.de
Date: Fri, 12 Jan 2018 15:42:06 +0100

> sendfile() calls can hang endless with using Kernel TLS if a socket error occurs.
> Socket error codes must be inverted by Kernel TLS before returning because
> they are stored with positive sign. If returned non-inverted they are
> interpreted as number of bytes sent, causing endless looping of the
> splice mechanic behind sendfile().
> 
> Signed-off-by: Robert Hering <r.hering@avm.de>

Applied and queued up for -stable, thanks.

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

* [PATCH] net/tls: Fix inverted error codes to avoid endless loop
@ 2018-01-12 14:42 r.hering
  2018-01-15 19:22 ` David Miller
  0 siblings, 1 reply; 6+ messages in thread
From: r.hering @ 2018-01-12 14:42 UTC (permalink / raw)
  To: davem, netdev

sendfile() calls can hang endless with using Kernel TLS if a socket error occurs.
Socket error codes must be inverted by Kernel TLS before returning because
they are stored with positive sign. If returned non-inverted they are
interpreted as number of bytes sent, causing endless looping of the
splice mechanic behind sendfile().

Signed-off-by: Robert Hering <r.hering@avm.de>
---
diff --git a/include/net/tls.h b/include/net/tls.h
index 936cfc5..9185e53 100644
--- a/include/net/tls.h
+++ b/include/net/tls.h
@@ -170,7 +170,7 @@ static inline bool tls_is_pending_open_record(struct tls_context *tls_ctx)
 
 static inline void tls_err_abort(struct sock *sk)
 {
-	sk->sk_err = -EBADMSG;
+	sk->sk_err = EBADMSG;
 	sk->sk_error_report(sk);
 }
 
diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c
index 73d1921..9773571 100644
--- a/net/tls/tls_sw.c
+++ b/net/tls/tls_sw.c
@@ -391,7 +391,7 @@ int tls_sw_sendmsg(struct sock *sk, struct msghdr *msg, size_t size)
 
 	while (msg_data_left(msg)) {
 		if (sk->sk_err) {
-			ret = sk->sk_err;
+			ret = -sk->sk_err;
 			goto send_end;
 		}
 
@@ -544,7 +544,7 @@ int tls_sw_sendpage(struct sock *sk, struct page *page,
 		size_t copy, required_size;
 
 		if (sk->sk_err) {
-			ret = sk->sk_err;
+			ret = -sk->sk_err;
 			goto sendpage_end;
 		}

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

* Re: [PATCH] net/tls: Fix inverted error codes to avoid endless loop
  2017-12-14 18:55 r.hering
@ 2017-12-15 18:49 ` David Miller
  0 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2017-12-15 18:49 UTC (permalink / raw)
  To: r.hering; +Cc: netdev

From: r.hering@avm.de
Date: Thu, 14 Dec 2017 19:55:14 +0100

> sendfile() calls can hang endless with using Kernel TLS if a socket error 
> occurs.
> Socket error codes must be inverted by Kernel TLS before returning because
> they are stored with positive sign. If returned non-inverted they are
> interpreted as number of bytes sent, causing endless looping of the
> splice mechanic behind sendfile().
> 
> Signed-off-by: Robert Hering <r.hering@avm.de>

Your patch is corrupted again, exactly the same like last time.

I asked you politely to send a test patch to yourself, and make sure you
could apply the patch cleanly.

Because TABs have been corrupted into spaces, exactly like last time,
I cannot see how you could have possibly succesfully done such a test
before posting here again.

Please fix this properly, get your email client sending patches without
modifying the text, and only then resubmit this patch.

Thank you.

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

* [PATCH] net/tls: Fix inverted error codes to avoid endless loop
@ 2017-12-14 18:55 r.hering
  2017-12-15 18:49 ` David Miller
  0 siblings, 1 reply; 6+ messages in thread
From: r.hering @ 2017-12-14 18:55 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev

sendfile() calls can hang endless with using Kernel TLS if a socket error 
occurs.
Socket error codes must be inverted by Kernel TLS before returning because
they are stored with positive sign. If returned non-inverted they are
interpreted as number of bytes sent, causing endless looping of the
splice mechanic behind sendfile().

Signed-off-by: Robert Hering <r.hering@avm.de>
---
diff --git a/include/net/tls.h b/include/net/tls.h
index 936cfc5..9185e53 100644
--- a/include/net/tls.h
+++ b/include/net/tls.h
@@ -170,7 +170,7 @@ static inline bool tls_is_pending_open_record(struct 
tls_context *tls_ctx)
 
 static inline void tls_err_abort(struct sock *sk)
 {
-       sk->sk_err = -EBADMSG;
+       sk->sk_err = EBADMSG;
        sk->sk_error_report(sk);
 }
 
diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c
index 73d1921..9773571 100644
--- a/net/tls/tls_sw.c
+++ b/net/tls/tls_sw.c
@@ -391,7 +391,7 @@ int tls_sw_sendmsg(struct sock *sk, struct msghdr 
*msg, size_t size)
 
        while (msg_data_left(msg)) {
                if (sk->sk_err) {
-                       ret = sk->sk_err;
+                       ret = -sk->sk_err;
                        goto send_end;
                }
 
@@ -544,7 +544,7 @@ int tls_sw_sendpage(struct sock *sk, struct page 
*page,
                size_t copy, required_size;
 
                if (sk->sk_err) {
-                       ret = sk->sk_err;
+                       ret = -sk->sk_err;
                        goto sendpage_end;
                }

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

end of thread, other threads:[~2018-01-15 19:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-11 18:56 [PATCH] net/tls: Fix inverted error codes to avoid endless loop r.hering
2017-12-13 18:48 ` David Miller
2017-12-14 18:55 r.hering
2017-12-15 18:49 ` David Miller
2018-01-12 14:42 r.hering
2018-01-15 19:22 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.