aboutsummaryrefslogtreecommitdiffstats
path: root/net/unix
diff options
context:
space:
mode:
authorRainer Weikusat <rweikusat@mobileactivedefense.com>2016-02-18 07:39:46 -0500
committerDavid S. Miller <davem@davemloft.net>2016-02-19 23:50:31 -0500
commit18eceb818dc37bbc783ec7ef7703f270cc6cd281 (patch)
tree1b22d754e79d5b879f1c1315f4966c057a610993 /net/unix
parentb5f0549231ffb025337be5a625b0ff9f52b016f0 (diff)
af_unix: Don't use continue to re-execute unix_stream_read_generic loop
The unix_stream_read_generic function tries to use a continue statement to restart the receive loop after waiting for a message. This may not work as intended as the caller might use a recvmsg call to peek at control messages without specifying a message buffer. If this was the case, the continue will cause the function to return without an error and without the credential information if the function had to wait for a message while it had returned with the credentials otherwise. Change to using goto to restart the loop without checking the condition first in this case so that credentials are returned either way. Signed-off-by: Rainer Weikusat <rweikusat@mobileactivedefense.com> Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/unix')
-rw-r--r--net/unix/af_unix.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index c51e2831f498..f75f847e688d 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -2312,6 +2312,7 @@ static int unix_stream_read_generic(struct unix_stream_read_state *state)
2312 bool drop_skb; 2312 bool drop_skb;
2313 struct sk_buff *skb, *last; 2313 struct sk_buff *skb, *last;
2314 2314
2315redo:
2315 unix_state_lock(sk); 2316 unix_state_lock(sk);
2316 if (sock_flag(sk, SOCK_DEAD)) { 2317 if (sock_flag(sk, SOCK_DEAD)) {
2317 err = -ECONNRESET; 2318 err = -ECONNRESET;
@@ -2353,7 +2354,7 @@ again:
2353 } 2354 }
2354 2355
2355 mutex_lock(&u->readlock); 2356 mutex_lock(&u->readlock);
2356 continue; 2357 goto redo;
2357unlock: 2358unlock:
2358 unix_state_unlock(sk); 2359 unix_state_unlock(sk);
2359 break; 2360 break;