netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-2.6 1/6] caif: Bugfix - wait_ev*_timeout returns long.
@ 2010-05-21 12:16 sjur.brandeland
  2010-05-21 12:16 ` [PATCH net-2.6 2/6] caif: Bugfix - use standard Linux lists sjur.brandeland
  2010-05-24  6:40 ` [PATCH net-2.6 1/6] caif: Bugfix - wait_ev*_timeout returns long David Miller
  0 siblings, 2 replies; 12+ messages in thread
From: sjur.brandeland @ 2010-05-21 12:16 UTC (permalink / raw)
  To: netdev, davem; +Cc: sjurbr, linus.walleij, marcel, Sjur Braendeland

From: Sjur Braendeland <sjur.brandeland@stericsson.com>

Discovered bug when testing on 64bit architecture.
Fixed by using long to store result from wait_event_interruptible_timeout.

Signed-off-by: Sjur Braendeland <sjur.brandeland@stericsson.com>
---
 net/caif/caif_socket.c |   13 ++++++-------
 1 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/net/caif/caif_socket.c b/net/caif/caif_socket.c
index c3a70c5..77e9956 100644
--- a/net/caif/caif_socket.c
+++ b/net/caif/caif_socket.c
@@ -920,17 +920,17 @@ wait_connect:
 	timeo = sock_sndtimeo(sk, flags & O_NONBLOCK);
 
 	release_sock(sk);
-	err = wait_event_interruptible_timeout(*sk_sleep(sk),
+	err = -ERESTARTSYS;
+	timeo = wait_event_interruptible_timeout(*sk_sleep(sk),
 			sk->sk_state != CAIF_CONNECTING,
 			timeo);
 	lock_sock(sk);
-	if (err < 0)
+	if (timeo < 0)
 		goto out; /* -ERESTARTSYS */
-	if (err == 0 && sk->sk_state != CAIF_CONNECTED) {
-		err = -ETIMEDOUT;
-		goto out;
-	}
 
+	err = -ETIMEDOUT;
+	if (timeo == 0 && sk->sk_state != CAIF_CONNECTED)
+		goto out;
 	if (sk->sk_state != CAIF_CONNECTED) {
 		sock->state = SS_UNCONNECTED;
 		err = sock_error(sk);
@@ -945,7 +945,6 @@ out:
 	return err;
 }
 
-
 /*
  * caif_release() - Disconnect a CAIF Socket
  * Copied and modified af_irda.c:irda_release().
-- 
1.6.3.3


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

end of thread, other threads:[~2010-05-24  6:40 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-21 12:16 [PATCH net-2.6 1/6] caif: Bugfix - wait_ev*_timeout returns long sjur.brandeland
2010-05-21 12:16 ` [PATCH net-2.6 2/6] caif: Bugfix - use standard Linux lists sjur.brandeland
2010-05-21 12:16   ` [PATCH net-2.6 3/6] caif: Bugfix - handle mem-allocation failures sjur.brandeland
2010-05-21 12:16     ` [PATCH net-2.6 4/6] caif: Bugfix - Poll can't return POLLHUP while connecting sjur.brandeland
2010-05-21 12:16       ` [PATCH net-2.6 5/6] caif: Bugfix - missing spin_unlock sjur.brandeland
2010-05-21 12:16         ` [PATCH net-2.6 6/6] caif: Bugfix - use MSG_TRUNC in receive sjur.brandeland
2010-05-24  6:40           ` David Miller
2010-05-24  6:40         ` [PATCH net-2.6 5/6] caif: Bugfix - missing spin_unlock David Miller
2010-05-24  6:40       ` [PATCH net-2.6 4/6] caif: Bugfix - Poll can't return POLLHUP while connecting David Miller
2010-05-24  6:40     ` [PATCH net-2.6 3/6] caif: Bugfix - handle mem-allocation failures David Miller
2010-05-24  6:40   ` [PATCH net-2.6 2/6] caif: Bugfix - use standard Linux lists David Miller
2010-05-24  6:40 ` [PATCH net-2.6 1/6] caif: Bugfix - wait_ev*_timeout returns long David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).