From: Sylwester Nawrocki Date: Mon, 21 Aug 2017 16:19:50 +0000 (+0200) Subject: fimc-is: Remove BUG() from fimc_is_itf_s_param() X-Git-Tag: submit/tizen/20190329.020226~265 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=61695eeeff0e7ff8c29cc7a90373528b62839576;p=platform%2Fkernel%2Flinux-exynos.git fimc-is: Remove BUG() from fimc_is_itf_s_param() 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 --- diff --git a/drivers/media/platform/exynos/fimc-is/fimc-is-device-ischain.c b/drivers/media/platform/exynos/fimc-is/fimc-is-device-ischain.c index 3742c45161de..24a5e9a3f306 100644 --- a/drivers/media/platform/exynos/fimc-is/fimc-is-device-ischain.c +++ b/drivers/media/platform/exynos/fimc-is/fimc-is-device-ischain.c @@ -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;