[PATCH] hidp: Ensure the session is marked as terminating to enable other functions to abort early.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Karl Relton <karllinuxtest.relton@xxxxxxxxxxxx>

Ensure the session is marked as terminating no matter how hidp_session
drops out of its main loop.

This enables other functions (such as hidp_get_raw_report) to
abort early once a session is in its closing
stages - important since the cleanup of a session will remove
input/hid devices which (via the power_supply code) will typically
trigger a call to hidp_get_raw_report for an ill-fated attempt to
get the battery status. Without this change hidp_get_raw_report
can end up stalling the cleanup process for its 5 second timeout.

Signed-off-by: Karl Relton <karllinuxtest.relton@xxxxxxxxxxxx>
Reviewed-by: David Herrmann <dh.herrmann@xxxxxxxxx>
---
 net/bluetooth/hidp/core.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c
index b2bcbe2..ba9badc 100644
--- a/net/bluetooth/hidp/core.c
+++ b/net/bluetooth/hidp/core.c
@@ -722,6 +722,7 @@ static int hidp_session(void *arg)
 		set_current_state(TASK_INTERRUPTIBLE);
 	}
 	set_current_state(TASK_RUNNING);
+	atomic_inc(&session->terminate);
 	remove_wait_queue(sk_sleep(intr_sk), &intr_wait);
 	remove_wait_queue(sk_sleep(ctrl_sk), &ctrl_wait);
 
-- 
1.7.9.5



--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux