Skip to contentSkip to conversation

net: Fix the condition passed to sk_wait_event()

PATCH Nagendra Tomar 3 participants 5 messages Oct 2, 2010 – Oct 3, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

This is the first part of the split up patch submitted in http://www.spinics.net/lists/netdev/msg142617.html

This patch fixes the sk_wait_event() condition in the sk_stream_wait_connect() function. With this change, we correctly check for the TCPF_ESTABLISHED and TCPF_CLOSE_WAIT states and avoid potentially returning success when there is an error on the socket.

---

net/core/stream.c renamed from net/core/stream.c.orig +2 -3
@@ -73,9 +73,8 @@ int sk_stream_wait_connect(struct sock *
 		prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE);
 		sk->sk_write_pending++;
 		done = sk_wait_event(sk, timeo_p,
-				     !sk->sk_err &&
-				     !((1 << sk->sk_state) &
-				       ~(TCPF_ESTABLISHED | TCPF_CLOSE_WAIT)));
+				     ((1 << sk->sk_state) &
+				       (TCPF_ESTABLISHED | TCPF_CLOSE_WAIT)));
 		finish_wait(sk_sleep(sk), &wait);
 		sk->sk_write_pending--;
 	} while (!done);
maintainer
#1 lore raw

Your patch is still corrupted, your email client is splitting up long lines.

Please, save us a lot of time by test emailing the patch to yourself, and then trying to apply the patch as you receive it. Do this until you're fixed all of the formatting problems and then you can send it here.

Do not resend the patch by simply replying again to this thread, send a fresh posting so that "Re: " doesn't show up in the subject and this way I can apply it directly without any editing.

Thank you.

#2 lore raw

Dave,
I had done the exercise of sending the patch to myself and applying it (copy-pasting just the patch). One thing that I see is the long line in the description. If you are referring to that, I've fixed it and submitted it again. If not this, I'm at loss.

Thanks,
Tomar

Quoted 26 lines · David Miller

From: David Miller <[email protected]>
Subject: Re: [PATCH 1/2] net: Fix the condition passed to sk_wait_event()
To: [email protected]
Cc: [email protected], [email protected]
Date: Sunday, 3 October, 2010, 1:56

Your patch is still corrupted, your email client is splitting up
long lines.

Please, save us a lot of time by test emailing the patch to yourself,
and then trying to apply the patch as you receive it. Do this until
you're fixed all of the formatting problems and then you can send it
here.

Do not resend the patch by simply replying again to this thread,
send a fresh posting so that "Re: " doesn't show up in the subject
and this way I can apply it directly without any editing.

Thank you.

maintainer
#3 lore raw

From: Nagendra Tomar <[email protected]>
Date: Sat, 2 Oct 2010 16:54:23 -0700 (PDT)

Quoted 5 lines

I had done the exercise of sending the patch to myself and applying it (copy-pasting just the patch). One thing that I see is the long line in the description. If you are referring to that, I've fixed it and submitted it again. If not this, I'm at loss.

This new submission looks good, thank you.

#4 lore raw
Quoted 10 lines · David Miller

From: Nagendra Tomar <[email protected]>
Date: Sat, 2 Oct 2010 16:54:23 -0700 (PDT)

Quoted 5 lines

I had done the exercise of sending the patch to myself and applying it (copy-pasting just the patch). One thing that I see is the long line in the description. If you are referring to that, I've fixed it and submitted it again. If not this, I'm at loss.

This new submission looks good, thank you.

Yes, but the email address in the "Signed-odd-by: ...." is mangled :(