Browse Source

msm: camera: utils: Fix crash due to IRQ unsubscribe in top half

Iterate through the list of top half events safely to allow for
unsubscribing (list deletion and freeing the pointer) during top half
processing.

CRs-Fixed: 2910416
Change-Id: I5f079f47645c7222546610d8a5de39d86695b39d
Signed-off-by: Anand Ravi <[email protected]>
Anand Ravi 4 years ago
parent
commit
441200a543

+ 2 - 1
drivers/cam_isp/isp_hw_mgr/hw_utils/irq_controller/cam_irq_controller.c

@@ -582,6 +582,7 @@ static void cam_irq_controller_th_processing(
 	struct list_head               *th_list_head)
 	struct list_head               *th_list_head)
 {
 {
 	struct cam_irq_evt_handler     *evt_handler = NULL;
 	struct cam_irq_evt_handler     *evt_handler = NULL;
+	struct cam_irq_evt_handler     *evt_handler_tmp = NULL;
 	struct cam_irq_th_payload      *th_payload = &controller->th_payload;
 	struct cam_irq_th_payload      *th_payload = &controller->th_payload;
 	bool                            is_irq_match;
 	bool                            is_irq_match;
 	int                             rc = -EINVAL;
 	int                             rc = -EINVAL;
@@ -594,7 +595,7 @@ static void cam_irq_controller_th_processing(
 	if (list_empty(th_list_head))
 	if (list_empty(th_list_head))
 		return;
 		return;
 
 
-	list_for_each_entry(evt_handler, th_list_head, th_list_node) {
+	list_for_each_entry_safe(evt_handler, evt_handler_tmp, th_list_head, th_list_node) {
 		is_irq_match = cam_irq_controller_match_bit_mask(controller,
 		is_irq_match = cam_irq_controller_match_bit_mask(controller,
 			evt_handler);
 			evt_handler);