msm: BA: Avoid null pointer dereferencing
Add null pointer checking to avoid null pointer dereferencing for ba input. Change-Id: Ic54bbf8748a78c7f33540cab2ec32b753969fa06 Signed-off-by: Domi Papoi <dpapoi@codeaurora.org>
This commit is contained in:
parent
2fcbbaa101
commit
841681b801
1 changed files with 10 additions and 3 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2012-2015, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 and
|
||||
|
@ -524,14 +524,18 @@ int msm_ba_save_restore_input(void *instance, enum msm_ba_save_restore_ip sr)
|
|||
msm_ba_reset_ip_in_use_from_sd(inst->sd);
|
||||
ba_input = msm_ba_find_input_from_sd(inst->sd,
|
||||
inst->saved_input);
|
||||
ba_input->in_use = 1;
|
||||
if (ba_input)
|
||||
ba_input->in_use = 1;
|
||||
else
|
||||
dprintk(BA_WARN, "Could not find input %d from sd: %s",
|
||||
inst->saved_input, inst->sd->name);
|
||||
inst->restore = 0;
|
||||
inst->saved_input = BA_IP_MAX;
|
||||
dprintk(BA_DBG, "Stream on from save restore");
|
||||
rc = msm_ba_streamon(inst, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE);
|
||||
} else if (sr == BA_SR_SAVE_IP) {
|
||||
ba_input = msm_ba_find_input(inst->sd_input.index);
|
||||
if (ba_input->ba_out_in_use) {
|
||||
if (ba_input && ba_input->ba_out_in_use) {
|
||||
inst->restore = 1;
|
||||
inst->saved_input =
|
||||
msm_ba_find_ip_in_use_from_sd(inst->sd);
|
||||
|
@ -543,6 +547,9 @@ int msm_ba_save_restore_input(void *instance, enum msm_ba_save_restore_ip sr)
|
|||
inst->saved_input);
|
||||
rc = -EBUSY;
|
||||
}
|
||||
if (!ba_input)
|
||||
dprintk(BA_WARN, "Couldn't find input idx %d to save",
|
||||
inst->sd_input.index);
|
||||
} else {
|
||||
dprintk(BA_DBG, "Nothing to do in save and restore");
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue