diff options
| author | Marcel Holtmann <marcel@holtmann.org> | 2006-10-15 11:31:05 -0400 |
|---|---|---|
| committer | David S. Miller <davem@sunset.davemloft.net> | 2006-10-16 02:14:32 -0400 |
| commit | b2cfcd75df77b80d9cc3fa84190a350dfa79eb93 (patch) | |
| tree | 661abc82652a6cc7ff665861d98d127e2152affc /net/bluetooth | |
| parent | e86070c83e9110e89800274385c013db602b1444 (diff) | |
[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: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth')
| -rw-r--r-- | net/bluetooth/bnep/core.c | 4 | ||||
| -rw-r--r-- | net/bluetooth/hidp/core.c | 4 | ||||
| -rw-r--r-- | net/bluetooth/rfcomm/tty.c | 4 |
3 files changed, 3 insertions, 9 deletions
diff --git a/net/bluetooth/bnep/core.c b/net/bluetooth/bnep/core.c index 2312d050eeed..4d3424c2421c 100644 --- a/net/bluetooth/bnep/core.c +++ b/net/bluetooth/bnep/core.c | |||
| @@ -528,12 +528,10 @@ static struct device *bnep_get_device(struct bnep_session *session) | |||
| 528 | return NULL; | 528 | return NULL; |
| 529 | 529 | ||
| 530 | conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, dst); | 530 | conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, dst); |
| 531 | if (!conn) | ||
| 532 | return NULL; | ||
| 533 | 531 | ||
| 534 | hci_dev_put(hdev); | 532 | hci_dev_put(hdev); |
| 535 | 533 | ||
| 536 | return &conn->dev; | 534 | return conn ? &conn->dev : NULL; |
| 537 | } | 535 | } |
| 538 | 536 | ||
| 539 | int bnep_add_connection(struct bnep_connadd_req *req, struct socket *sock) | 537 | int bnep_add_connection(struct bnep_connadd_req *req, struct socket *sock) |
diff --git a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c index b2d6da67d885..9a562cf7406b 100644 --- a/net/bluetooth/hidp/core.c +++ b/net/bluetooth/hidp/core.c | |||
| @@ -541,12 +541,10 @@ static struct device *hidp_get_device(struct hidp_session *session) | |||
| 541 | return NULL; | 541 | return NULL; |
| 542 | 542 | ||
| 543 | conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, dst); | 543 | conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, dst); |
| 544 | if (!conn) | ||
| 545 | return NULL; | ||
| 546 | 544 | ||
| 547 | hci_dev_put(hdev); | 545 | hci_dev_put(hdev); |
| 548 | 546 | ||
| 549 | return &conn->dev; | 547 | return conn ? &conn->dev : NULL; |
| 550 | } | 548 | } |
| 551 | 549 | ||
| 552 | static inline void hidp_setup_input(struct hidp_session *session, struct hidp_connadd_req *req) | 550 | static inline void hidp_setup_input(struct hidp_session *session, struct hidp_connadd_req *req) |
diff --git a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c index 1958ad1b8541..5833b87c51cf 100644 --- a/net/bluetooth/rfcomm/tty.c +++ b/net/bluetooth/rfcomm/tty.c | |||
| @@ -172,12 +172,10 @@ static struct device *rfcomm_get_device(struct rfcomm_dev *dev) | |||
| 172 | return NULL; | 172 | return NULL; |
| 173 | 173 | ||
| 174 | conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &dev->dst); | 174 | conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &dev->dst); |
| 175 | if (!conn) | ||
| 176 | return NULL; | ||
| 177 | 175 | ||
| 178 | hci_dev_put(hdev); | 176 | hci_dev_put(hdev); |
| 179 | 177 | ||
| 180 | return &conn->dev; | 178 | return conn ? &conn->dev : NULL; |
| 181 | } | 179 | } |
| 182 | 180 | ||
| 183 | static int rfcomm_dev_add(struct rfcomm_dev_req *req, struct rfcomm_dlc *dlc) | 181 | static int rfcomm_dev_add(struct rfcomm_dev_req *req, struct rfcomm_dlc *dlc) |
