Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 61542d7f authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "Bluetooth: remove unnecessary check on BT_CLOSED socks during accept"

parents 68778712 08201b1a
Loading
Loading
Loading
Loading
+9 −8
Original line number Diff line number Diff line
@@ -179,20 +179,25 @@ void bt_sock_unlink(struct bt_sock_list *l, struct sock *sk)
}
EXPORT_SYMBOL(bt_sock_unlink);

/* bt_accept_enqueue is used to hold sockets between L2CAP new connection and
 * connect confirmation calls only .
 */
void bt_accept_enqueue(struct sock *parent, struct sock *sk)
{
	BT_DBG("parent %p, sk %p", parent, sk);

	sock_hold(sk);
	list_add_tail(&bt_sk(sk)->accept_q, &bt_sk(parent)->accept_q);
	bt_sk(sk)->parent = parent;
	parent->sk_ack_backlog++;
	list_add_tail(&bt_sk(sk)->accept_q, &bt_sk(parent)->accept_q);
}
EXPORT_SYMBOL(bt_accept_enqueue);

void bt_accept_unlink(struct sock *sk)
{
	BT_DBG("sk %p state %d", sk, sk->sk_state);
	if (!bt_sk(sk)->parent)
		return;

	list_del_init(&bt_sk(sk)->accept_q);
	bt_sk(sk)->parent->sk_ack_backlog--;
@@ -201,6 +206,9 @@ void bt_accept_unlink(struct sock *sk)
}
EXPORT_SYMBOL(bt_accept_unlink);

/* bt_accept_dequeue is called to only on accept ioctl and it returns
 * sockets in BT_CONNECTED state
 */
struct sock *bt_accept_dequeue(struct sock *parent, struct socket *newsock)
{
	struct list_head *p, *n;
@@ -213,13 +221,6 @@ struct sock *bt_accept_dequeue(struct sock *parent, struct socket *newsock)

		lock_sock(sk);

		/* FIXME: Is this check still needed */
		if (sk->sk_state == BT_CLOSED) {
			release_sock(sk);
			bt_accept_unlink(sk);
			continue;
		}

		if (sk->sk_state == BT_CONNECTED || !newsock ||
		    test_bit(BT_SK_DEFER_SETUP, &bt_sk(parent)->flags)) {
			bt_accept_unlink(sk);
+3 −0
Original line number Diff line number Diff line
@@ -1269,6 +1269,9 @@ static void l2cap_sock_teardown_cb(struct l2cap_chan *chan, int err)

		sk->sk_err = err;

		/* parent can be valid only when L2CAP connection is confirmed
		 * and accept ioctl call was scheduled on a timeout
		 */
		if (parent) {
			bt_accept_unlink(sk);
			parent->sk_data_ready(parent);