[media] media: ti-vpe: vpe: Return NULL for invalid buffer type
authorNikhil Devshatwar <[email protected]>
Fri, 18 Nov 2016 23:20:19 +0000 (21:20 -0200)
committerMauro Carvalho Chehab <[email protected]>
Tue, 22 Nov 2016 09:03:34 +0000 (07:03 -0200)
get_q_data can be called with different values for type
e.g. vpe_try_crop calls it with the buffer type which gets passed
from user space

Framework doesn't check wheather its correct type or not
If user space passes wrong type, kernel should not crash.
Return NULL when the passed type is invalid.

Signed-off-by: Nikhil Devshatwar <[email protected]>
Signed-off-by: Benoit Parrot <[email protected]>
Signed-off-by: Hans Verkuil <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
drivers/media/platform/ti-vpe/vpe.c

index c624f5db7f08216460b4981abbb235aad08564fd..4b6e8839dd83a5a939e23dacdb86545487b8ed7e 100644 (file)
@@ -420,7 +420,7 @@ static struct vpe_q_data *get_q_data(struct vpe_ctx *ctx,
        case V4L2_BUF_TYPE_VIDEO_CAPTURE:
                return &ctx->q_data[Q_DATA_DST];
        default:
-               BUG();
+               return NULL;
        }
        return NULL;
 }