msm: camera: add check for null queue pointer
crashes are possible without the
null pointer check for 'queue' in msm_open
Change-Id: I8c049ff1f3df092c36aec8696bfbef604ed2b99a
Signed-off-by: Vijay kumar Tumati <vtumati@codeaurora.org>
diff --git a/drivers/media/video/msm/msm.c b/drivers/media/video/msm/msm.c
index 034cbc5..425768a 100644
--- a/drivers/media/video/msm/msm.c
+++ b/drivers/media/video/msm/msm.c
@@ -1863,14 +1863,15 @@
}
msm_cam_server_open_session_failed:
if (pcam->use_count == 1) {
- queue->queue_active = 0;
- msm_drain_eventq(&queue->eventData_q);
- kfree(queue->ctrl_data);
- queue->ctrl_data = NULL;
- msm_queue_drain(&queue->ctrl_q, list_control);
- msm_drain_eventq(&queue->eventData_q);
- queue = NULL;
-
+ if (queue != NULL) {
+ queue->queue_active = 0;
+ msm_drain_eventq(&queue->eventData_q);
+ kfree(queue->ctrl_data);
+ queue->ctrl_data = NULL;
+ msm_queue_drain(&queue->ctrl_q, list_control);
+ msm_drain_eventq(&queue->eventData_q);
+ queue = NULL;
+ }
pcam->dev_inst[i] = NULL;
pcam->use_count = 0;
}