diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2008-07-14 14:13:53 -0400 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2008-07-14 14:13:53 -0400 |
commit | ec8dab36e0738d3059980d144e34f16a26bbda7d (patch) | |
tree | d1854559838c4ac228c9586faae44625c08d30ba /net | |
parent | a0c22f226502be6eab37a1d9bf6fb0fadf551376 (diff) |
[Bluetooth] Signal user-space for HIDP and BNEP socket errors
When using the HIDP or BNEP kernel support, the user-space needs to
know if the connection has been terminated for some reasons. Wake up
the application if that happens. Otherwise kernel and user-space are
no longer on the same page and weird behaviors can happen.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net')
-rw-r--r-- | net/bluetooth/bnep/core.c | 5 | ||||
-rw-r--r-- | net/bluetooth/hidp/core.c | 10 |
2 files changed, 15 insertions, 0 deletions
diff --git a/net/bluetooth/bnep/core.c b/net/bluetooth/bnep/core.c index f85d94643aaf..24e91eb7f649 100644 --- a/net/bluetooth/bnep/core.c +++ b/net/bluetooth/bnep/core.c | |||
@@ -507,6 +507,11 @@ static int bnep_session(void *arg) | |||
507 | /* Delete network device */ | 507 | /* Delete network device */ |
508 | unregister_netdev(dev); | 508 | unregister_netdev(dev); |
509 | 509 | ||
510 | /* Wakeup user-space polling for socket errors */ | ||
511 | s->sock->sk->sk_err = EUNATCH; | ||
512 | |||
513 | wake_up_interruptible(s->sock->sk->sk_sleep); | ||
514 | |||
510 | /* Release the socket */ | 515 | /* Release the socket */ |
511 | fput(s->sock->file); | 516 | fput(s->sock->file); |
512 | 517 | ||
diff --git a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c index 519cdb920f93..96434d774c84 100644 --- a/net/bluetooth/hidp/core.c +++ b/net/bluetooth/hidp/core.c | |||
@@ -581,6 +581,12 @@ static int hidp_session(void *arg) | |||
581 | hid_free_device(session->hid); | 581 | hid_free_device(session->hid); |
582 | } | 582 | } |
583 | 583 | ||
584 | /* Wakeup user-space polling for socket errors */ | ||
585 | session->intr_sock->sk->sk_err = EUNATCH; | ||
586 | session->ctrl_sock->sk->sk_err = EUNATCH; | ||
587 | |||
588 | hidp_schedule(session); | ||
589 | |||
584 | fput(session->intr_sock->file); | 590 | fput(session->intr_sock->file); |
585 | 591 | ||
586 | wait_event_timeout(*(ctrl_sk->sk_sleep), | 592 | wait_event_timeout(*(ctrl_sk->sk_sleep), |
@@ -879,6 +885,10 @@ int hidp_del_connection(struct hidp_conndel_req *req) | |||
879 | skb_queue_purge(&session->ctrl_transmit); | 885 | skb_queue_purge(&session->ctrl_transmit); |
880 | skb_queue_purge(&session->intr_transmit); | 886 | skb_queue_purge(&session->intr_transmit); |
881 | 887 | ||
888 | /* Wakeup user-space polling for socket errors */ | ||
889 | session->intr_sock->sk->sk_err = EUNATCH; | ||
890 | session->ctrl_sock->sk->sk_err = EUNATCH; | ||
891 | |||
882 | /* Kill session thread */ | 892 | /* Kill session thread */ |
883 | atomic_inc(&session->terminate); | 893 | atomic_inc(&session->terminate); |
884 | hidp_schedule(session); | 894 | hidp_schedule(session); |