Commit 4471109e3894 ("media: convert g/s_parm to g/s_frame_interval in subdevs") comverted former ov6650_g/s_parm() video_operation_callbacks to ov6650_g/s_frame_interval() pad operation callbacks. Howeveer, the new functions don't verify correcntess of pad IDs passed in user arguments. Fix it. Even if pad ID arguments are not actually used in those functions, assumed to be 0, always return -EINVAL if an operation on an invalid (non-zero) pad is requested by a user. Fixes: 4471109e3894 ("media: convert g/s_parm to g/s_frame_interval in subdevs") Signed-off-by: Janusz Krzysztofik <jmkrzyszt@xxxxxxxxx> Cc: stable@xxxxxxxxxxxxxxx --- drivers/media/i2c/ov6650.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/media/i2c/ov6650.c b/drivers/media/i2c/ov6650.c index 5df81dec06ae..1daef0c7ad91 100644 --- a/drivers/media/i2c/ov6650.c +++ b/drivers/media/i2c/ov6650.c @@ -770,6 +770,9 @@ static int ov6650_g_frame_interval(struct v4l2_subdev *sd, struct i2c_client *client = v4l2_get_subdevdata(sd); struct ov6650 *priv = to_ov6650(client); + if (ival->pad) + return -EINVAL; + ival->interval.numerator = GET_CLKRC_DIV(to_clkrc(&priv->tpf, priv->pclk_limit, priv->pclk_max)); ival->interval.denominator = FRAME_RATE_MAX; @@ -789,6 +792,9 @@ static int ov6650_s_frame_interval(struct v4l2_subdev *sd, int div, ret; u8 clkrc; + if (ival->pad) + return -EINVAL; + if (tpf->numerator == 0 || tpf->denominator == 0) div = 1; /* Reset to full rate */ else -- 2.21.0