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

Commit 72847ce0 authored by Johan Hedberg's avatar Johan Hedberg Committed by Marcel Holtmann
Browse files

Bluetooth: Call L2CAP teardown callback before clearing chan->conn



L2CAP channel implementations may want to still access the chan->conn
pointer. This will particularly be the case for SMP that will want to
clear a reference to the SMP channel in the l2cap_conn structure. The
only user of the teardown callback so far is l2cap_sock.c and for the
code there it makes no difference whether the callback is called before
or after clearing the chan->conn pointer.

Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
parent 14824308
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -566,6 +566,8 @@ void l2cap_chan_del(struct l2cap_chan *chan, int err)

	BT_DBG("chan %p, conn %p, err %d", chan, conn, err);

	chan->ops->teardown(chan, err);

	if (conn) {
		struct amp_mgr *mgr = conn->hcon->amp_mgr;
		/* Delete from channel list */
@@ -589,8 +591,6 @@ void l2cap_chan_del(struct l2cap_chan *chan, int err)
		amp_disconnect_logical_link(hs_hchan);
	}

	chan->ops->teardown(chan, err);

	if (test_bit(CONF_NOT_COMPLETE, &chan->conf_state))
		return;