diff options
| author | Jiri Kosina <jkosina@suse.cz> | 2011-09-15 15:08:05 +0200 | 
|---|---|---|
| committer | Jiri Kosina <jkosina@suse.cz> | 2011-09-15 15:08:18 +0200 | 
| commit | e060c38434b2caa78efe7cedaff4191040b65a15 (patch) | |
| tree | 407361230bf6733f63d8e788e4b5e6566ee04818 /net/bluetooth/rfcomm/sock.c | |
| parent | 10e4ac572eeffe5317019bd7330b6058a400dfc2 (diff) | |
| parent | cc39c6a9bbdebfcf1a7dee64d83bf302bc38d941 (diff) | |
| download | olio-linux-3.10-e060c38434b2caa78efe7cedaff4191040b65a15.tar.xz olio-linux-3.10-e060c38434b2caa78efe7cedaff4191040b65a15.zip  | |
Merge branch 'master' into for-next
Fast-forward merge with Linus to be able to merge patches
based on more recent version of the tree.
Diffstat (limited to 'net/bluetooth/rfcomm/sock.c')
| -rw-r--r-- | net/bluetooth/rfcomm/sock.c | 28 | 
1 files changed, 14 insertions, 14 deletions
diff --git a/net/bluetooth/rfcomm/sock.c b/net/bluetooth/rfcomm/sock.c index 8f01e6b11a7..482722bbc7a 100644 --- a/net/bluetooth/rfcomm/sock.c +++ b/net/bluetooth/rfcomm/sock.c @@ -485,11 +485,6 @@ static int rfcomm_sock_accept(struct socket *sock, struct socket *newsock, int f  	lock_sock(sk); -	if (sk->sk_state != BT_LISTEN) { -		err = -EBADFD; -		goto done; -	} -  	if (sk->sk_type != SOCK_STREAM) {  		err = -EINVAL;  		goto done; @@ -501,19 +496,20 @@ static int rfcomm_sock_accept(struct socket *sock, struct socket *newsock, int f  	/* Wait for an incoming connection. (wake-one). */  	add_wait_queue_exclusive(sk_sleep(sk), &wait); -	while (!(nsk = bt_accept_dequeue(sk, newsock))) { +	while (1) {  		set_current_state(TASK_INTERRUPTIBLE); -		if (!timeo) { -			err = -EAGAIN; + +		if (sk->sk_state != BT_LISTEN) { +			err = -EBADFD;  			break;  		} -		release_sock(sk); -		timeo = schedule_timeout(timeo); -		lock_sock(sk); +		nsk = bt_accept_dequeue(sk, newsock); +		if (nsk) +			break; -		if (sk->sk_state != BT_LISTEN) { -			err = -EBADFD; +		if (!timeo) { +			err = -EAGAIN;  			break;  		} @@ -521,8 +517,12 @@ static int rfcomm_sock_accept(struct socket *sock, struct socket *newsock, int f  			err = sock_intr_errno(timeo);  			break;  		} + +		release_sock(sk); +		timeo = schedule_timeout(timeo); +		lock_sock(sk);  	} -	set_current_state(TASK_RUNNING); +	__set_current_state(TASK_RUNNING);  	remove_wait_queue(sk_sleep(sk), &wait);  	if (err)  |