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

Commit b2cfcd75 authored by Marcel Holtmann's avatar Marcel Holtmann Committed by David S. Miller
Browse files

[Bluetooth] Fix reference count when connection lookup fails



When the connection lookup for the device structure fails, the reference
count for the HCI device needs to be decremented.

Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
parent e86070c8
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -528,12 +528,10 @@ static struct device *bnep_get_device(struct bnep_session *session)
		return NULL;

	conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, dst);
	if (!conn)
		return NULL;

	hci_dev_put(hdev);

	return &conn->dev;
	return conn ? &conn->dev : NULL;
}

int bnep_add_connection(struct bnep_connadd_req *req, struct socket *sock)
+1 −3
Original line number Diff line number Diff line
@@ -541,12 +541,10 @@ static struct device *hidp_get_device(struct hidp_session *session)
		return NULL;

	conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, dst);
	if (!conn)
		return NULL;

	hci_dev_put(hdev);

	return &conn->dev;
	return conn ? &conn->dev : NULL;
}

static inline void hidp_setup_input(struct hidp_session *session, struct hidp_connadd_req *req)
+1 −3
Original line number Diff line number Diff line
@@ -172,12 +172,10 @@ static struct device *rfcomm_get_device(struct rfcomm_dev *dev)
		return NULL;

	conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &dev->dst);
	if (!conn)
		return NULL;

	hci_dev_put(hdev);

	return &conn->dev;
	return conn ? &conn->dev : NULL;
}

static int rfcomm_dev_add(struct rfcomm_dev_req *req, struct rfcomm_dlc *dlc)