[ERD][RAMEN9610-20325][COMMON] fimc-is2: Fix prevent issues
authorSanghoon Lee <shoon114.lee@samsung.com>
Wed, 24 Jul 2019 07:21:45 +0000 (16:21 +0900)
committerrobot <robot@samsung.com>
Mon, 7 Oct 2019 05:06:45 +0000 (14:06 +0900)
ISSUE JIRA ID: MAKA9820-6229, NEUS7920-327, RAMEN9610-16606, RAMEN9610-18289
PR JIRA ID: CSWPR-124

Change-Id: I275d7c1e2d9de196c6f42aaae065879401d95e8e
Signed-off-by: Sanghoon Lee <shoon114.lee@samsung.com>
drivers/media/platform/exynos/fimc-is2/hardware/fimc-is-hw-control.c
drivers/media/platform/exynos/fimc-is2/sensor/module_framework/actuator/fimc-is-actuator-dw9714.c
drivers/media/platform/exynos/fimc-is2/sensor/module_framework/actuator/fimc-is-actuator-dw9804.c
drivers/media/platform/exynos/fimc-is2/sensor/module_framework/actuator/fimc-is-actuator-dw9807.c
drivers/media/platform/exynos/fimc-is2/sensor/module_framework/actuator/fimc-is-actuator-dw9839.c
drivers/media/platform/exynos/fimc-is2/sensor/module_framework/actuator/fimc-is-actuator-lc898217.c
drivers/media/platform/exynos/fimc-is2/sensor/module_framework/actuator/fimc-is-actuator-zc533.c
drivers/media/platform/exynos/fimc-is2/sensor/module_framework/actuator/fimc-is-actuator-zc569.c

index 271711d91e3f46fc819a509b3d5021fedd54204d..de90d791847eb27e151e69a249b380d41db08572 100644 (file)
@@ -2219,6 +2219,10 @@ int fimc_is_hardware_close(struct fimc_is_hardware *hardware,u32 hw_id, u32 inst
        refcount = atomic_dec_return(&hw_ip->rsccount);
        if (refcount == 0) {
                u32 group_id = get_group_id_from_hw_ip(hw_ip->id);
+               if (group_id >= GROUP_ID_MAX) {
+                       merr_hw("[ID:%d]invalid group_id %d", instance, hw_ip->id, group_id);
+                       return -EINVAL;
+               }
 
                msdbg_hw(1, "%s: [G:0x%x], framemgr[ID:0x%x]->framemgr[ID:0x%x]\n",
                        instance, hw_ip, __func__, GROUP_ID(group_id),
index 8522e5bfa652d2e5aa9d22ef34980e259fb32c4c..caea4220dc0111db97c2fdab1427447c6097a088 100644 (file)
@@ -435,9 +435,15 @@ static int sensor_dw9714_actuator_probe(struct i2c_client *client,
        set_bit(FIMC_IS_SENSOR_ACTUATOR_AVAILABLE, &sensor_peri->peri_state);
 
        snprintf(subdev_actuator->name, V4L2_SUBDEV_NAME_SIZE, "actuator-subdev.%d", actuator->id);
-p_err:
+
        probe_info("%s done\n", __func__);
        return ret;
+
+p_err:
+       if (subdev_actuator)
+               kzfree(subdev_actuator);
+
+       return ret;
 }
 
 static const struct of_device_id sensor_actuator_dw9714_match[] = {
index 9a58dad337001077a34ec7e33f8d24c9d68cc40b..0518920f6c7f9cbf2e38ac740a216d5204a645db 100644 (file)
@@ -540,9 +540,15 @@ static int sensor_dw9804_actuator_probe(struct i2c_client *client,
        set_bit(FIMC_IS_SENSOR_ACTUATOR_AVAILABLE, &sensor_peri->peri_state);
 
        snprintf(subdev_actuator->name, V4L2_SUBDEV_NAME_SIZE, "actuator-subdev.%d", actuator->id);
-p_err:
+
        probe_info("%s done\n", __func__);
        return ret;
+
+p_err:
+       if (subdev_actuator)
+               kzfree(subdev_actuator);
+
+       return ret;
 }
 
 static const struct of_device_id sensor_actuator_dw9804_match[] = {
index df20f65ec5c6dff6668f9e8dcb74f222f8a29860..7a9537465020ce684da9db9f92aa7897d657b021 100644 (file)
@@ -560,9 +560,15 @@ static int sensor_dw9807_actuator_probe(struct i2c_client *client,
        set_bit(FIMC_IS_SENSOR_ACTUATOR_AVAILABLE, &sensor_peri->peri_state);
 
        snprintf(subdev_actuator->name, V4L2_SUBDEV_NAME_SIZE, "actuator-subdev.%d", actuator->id);
-p_err:
+
        probe_info("%s done\n", __func__);
        return ret;
+
+p_err:
+       if (subdev_actuator)
+               kzfree(subdev_actuator);
+
+       return ret;
 }
 
 static const struct of_device_id sensor_actuator_dw9807_match[] = {
index c2629082a2ebb41b60c6cb1538ecf347a58bc08b..e04f837c1a465f659b250c667883dd7136766e45 100644 (file)
@@ -644,9 +644,21 @@ static int sensor_dw9839_actuator_probe(struct i2c_client *client,
        set_bit(FIMC_IS_SENSOR_ACTUATOR_AVAILABLE, &sensor_peri->peri_state);
 
        snprintf(subdev_actuator->name, V4L2_SUBDEV_NAME_SIZE, "actuator-subdev.%d", actuator->id);
-p_err:
+
        probe_info("%s done\n", __func__);
        return ret;
+
+p_err:
+       if (actuator && actuator->priv_info)
+               vfree(actuator->priv_info);
+
+       if (actuator)
+               kzfree(actuator);
+
+       if (subdev_actuator)
+               kzfree(subdev_actuator);
+
+       return ret;
 }
 
 static const struct of_device_id sensor_actuator_dw9839_match[] = {
index 2b3bf51299ab4fd31564efa3322319c0a7d3d19a..995d38b3d6f61e7a9316198e15aad5660073338b 100755 (executable)
@@ -456,9 +456,18 @@ static int sensor_lc898217_actuator_probe(struct i2c_client *client,
        set_bit(FIMC_IS_SENSOR_ACTUATOR_AVAILABLE, &sensor_peri->peri_state);
 
        snprintf(subdev_actuator->name, V4L2_SUBDEV_NAME_SIZE, "actuator-subdev.%d", actuator->id);
-p_err:
+
        probe_info("%s done\n", __func__);
        return ret;
+
+p_err:
+       if (actuator)
+               kzfree(actuator);
+
+       if (subdev_actuator)
+               kzfree(subdev_actuator);
+
+       return ret;
 }
 
 static const struct of_device_id sensor_actuator_lc898217_match[] = {
index dd7dac695e64996c0c8e188c4be5b13badddecf4..8af3ca288be61d9a53b9b0d18f75d312d4a62851 100644 (file)
@@ -522,9 +522,18 @@ static int sensor_zc533_actuator_probe(struct i2c_client *client,
        v4l2_set_subdev_hostdata(subdev_actuator, device);
 
        snprintf(subdev_actuator->name, V4L2_SUBDEV_NAME_SIZE, "actuator-subdev.%d", actuator->id);
-p_err:
+
        probe_info("%s done\n", __func__);
        return ret;
+
+p_err:
+       if (actuator)
+               kzfree(actuator);
+
+       if (subdev_actuator)
+               kzfree(subdev_actuator);
+
+       return ret;
 }
 
 static const struct of_device_id sensor_actuator_zc533_match[] = {
index ab419227d16e1764f340feffa945df1d18bba5b3..2fdbaa2b58660ef5f3209b9de9b7031f6a1552b2 100755 (executable)
@@ -543,9 +543,17 @@ int sensor_zc569_actuator_probe(struct i2c_client *client,
 
        snprintf(subdev_actuator->name, V4L2_SUBDEV_NAME_SIZE, "actuator-subdev.%d", actuator->id);
 
-p_err:
        probe_info("%s done\n", __func__);
        return ret;
+
+p_err:
+       if (actuator)
+               kzfree(actuator);
+
+       if (subdev_actuator)
+               kzfree(subdev_actuator);
+
+       return ret;
 }
 
 static int sensor_zc569_actuator_remove(struct i2c_client *client)