[COMMON] media: smfc: fix security problem
authorSeungchul Kim <sc377.kim@samsung.com>
Fri, 23 Mar 2018 08:00:40 +0000 (17:00 +0900)
committerCosmin Tanislav <demonsingur@gmail.com>
Mon, 22 Apr 2024 17:22:20 +0000 (20:22 +0300)
The security problem has been reported in smfc driver.
If user sends a special ioctl command,
smfc driver can cause a kernel panic.
So it is modified to avoid kernel panic.

Change-Id: I7b5c4e295e8190cf0fb50d3c4b951a74470101ad
Signed-off-by: Seungchul Kim <sc377.kim@samsung.com>
drivers/media/platform/exynos/smfc/smfc-v4l2-ioctls.c

index 0c4bc5b02ca0b6d68a1fb09cbc825f2c9462f2e8..1d1720fd3fb91b624426dbc0721957108fa68ef8 100644 (file)
@@ -796,7 +796,11 @@ static bool smfc_v4l2_init_fmt(const struct smfc_ctx *ctx,
                                const struct smfc_image_format *smfc_fmt,
                                __u32 type, struct v4l2_pix_format *pix)
 {
-       BUG_ON(V4L2_TYPE_IS_MULTIPLANAR(pix->pixelformat));
+       if (V4L2_TYPE_IS_MULTIPLANAR(pix->pixelformat)) {
+               dev_err(ctx->smfc->dev,
+                       "Multi-planar format is not permitted.\n");
+               return false;
+       }
 
        if (!smfc_check_capable_of_decompression(ctx->smfc, smfc_fmt, type))
                return false;