1
0

staging: atomisp: off by one in atomisp_acc_load_extensions()

We should be doing i-- on all error paths but we don't if the loop
finishes successfully.  I've re-arranged this so that we don't read
beyond the end of acc_flag_to_pipe[] array.

Fixes: a49d25364d ("staging/atomisp: Add support for the Intel IPU v2")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Dan Carpenter
2017-03-14 10:51:31 +03:00
committed by Greg Kroah-Hartman
parent d862197186
commit f07d4b4270

View File

@@ -472,10 +472,8 @@ int atomisp_acc_load_extensions(struct atomisp_sub_device *asd)
acc_fw->fw,
acc_flag_to_pipe[i].pipe_id,
acc_fw->type);
if (ret) {
i--;
if (ret)
goto error;
}
ext_loaded = true;
}
@@ -499,7 +497,7 @@ int atomisp_acc_load_extensions(struct atomisp_sub_device *asd)
return 0;
error:
for (; i >= 0; i--) {
while (--i >= 0) {
if (acc_fw->flags & acc_flag_to_pipe[i].flag) {
atomisp_css_unload_acc_extension(asd, acc_fw->fw,
acc_flag_to_pipe[i].pipe_id);