fimc-is: Remove BUG() from fimc_is_itf_s_param() 07/145207/1 accepted/tizen/4.0/unified/20170829.020507 accepted/tizen/unified/20170822.023852 submit/tizen/20170822.003618 submit/tizen_4.0/20170828.100004
authorSylwester Nawrocki <s.nawrocki@samsung.com>
Mon, 21 Aug 2017 16:19:50 +0000 (18:19 +0200)
committerSylwester Nawrocki <s.nawrocki@samsung.com>
Mon, 21 Aug 2017 16:19:50 +0000 (18:19 +0200)
The condition being tested for that BUG() invocation is often
recoverable, so replace BUG() with a WARN_ON() and return EINVAL.
This prevents specific user space call sequences crashing the kernel,
which should never happen.
The callers of fimc_is_itf_s_param() function will be updated in
subsequent patches if necessary, to prevent any further possible
crashes.

Change-Id: I90a08278baa0cee85a4a69fa1b278e28e5c6764a
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
drivers/media/platform/exynos/fimc-is/fimc-is-device-ischain.c

index 3742c45..24a5e9a 100644 (file)
@@ -1356,9 +1356,9 @@ static int fimc_is_itf_s_param(struct fimc_is_device_ischain *device,
        BUG_ON(!device);
 
        if (frame) {
-               if (!test_bit(FIMC_IS_ISHCAIN_START, &device->state)) {
+               if (WARN_ON(!test_bit(FIMC_IS_ISHCAIN_START, &device->state))) {
                        merr("s_param failed, device already is stopped", device);
-                       BUG();
+                       return -EINVAL;
                }
 
                dst_base = &device->is_region->parameter;