Skip to contentSkip to conversation

staging: media: atomisp: Disallow all private IOCTLSs but S_PARAMETERS

PATCH In review Sakari Ailus 2 participants 4 messages Feb 27 – Feb 28

Subsystems (4)
lore
Share & tools
lore

Sakari Ailus

author reviewer
#0 lore raw

PATCH 1/1 staging: media: atomisp: Disallow all private IOCTLSs but S_PARAMETERS

Disallow all private IOCTLs except ATOMISP_IOC_S_PARAMETERS. These aren't quite as safe as one could assume of IOCTL handlers; disable them for now. Instead of removing the code, simply check the IOCTL matches with S_PARAMETERS and bail out otherwise, in order to ease backporting.

In particular, ATOMISP_IOC_S_ISP_FPN_TABLE is disabled by this patch.

Fixes ad85094b293e ("Revert "media: staging: atomisp: Remove driver"")
---
 drivers/staging/media/atomisp/pci/atomisp_ioctl.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/staging/media/atomisp/pci/atomisp_ioctl.c +4 -0
index a7f22de1c889..78e14c9aeed8 100644
@@ -1356,6 +1356,10 @@ static int atomisp_s_parm(struct file *file, void *fh,
 static long atomisp_vidioc_default(struct file *file, void *fh,
 				   bool valid_prio, unsigned int cmd, void *arg)
 {
+	/* Only allow ATOMISP_IOC_S_PARAMETERS for now! */
+	if (cmd != ATOMISP_IOC_S_PARAMETERS)
+		return -EINVAL;
+
 	struct video_device *vdev = video_devdata(file);
 	struct atomisp_sub_device *asd = atomisp_to_video_pipe(vdev)->asd;
 	int err;
Signature · 1 line
2.47.3
#1 lore raw
Quoted 6 lines · Sakari Ailus

Disallow all private IOCTLs except ATOMISP_IOC_S_PARAMETERS. These aren't quite as safe as one could assume of IOCTL handlers; disable them for now. Instead of removing the code, simply check the IOCTL matches with S_PARAMETERS and bail out otherwise, in order to ease backporting.

In particular, ATOMISP_IOC_S_ISP_FPN_TABLE is disabled by this patch.

Why not removing the code?
It's still and will be in the Git index, it won't disappear.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
author reviewer
#2 lore raw

Hi Andy,

Quoted 10 lines · Andy Shevchenko
Quoted 6 lines · Sakari Ailus

Disallow all private IOCTLs except ATOMISP_IOC_S_PARAMETERS. These aren't quite as safe as one could assume of IOCTL handlers; disable them for now. Instead of removing the code, simply check the IOCTL matches with S_PARAMETERS and bail out otherwise, in order to ease backporting.

In particular, ATOMISP_IOC_S_ISP_FPN_TABLE is disabled by this patch.

Why not removing the code?
It's still and will be in the Git index, it won't disappear.

There have been changes in the IOCTL handler over the supported kernel versions. This patch can be backported all the way down to v5.10.

I'm fine with removing the now-redundant code, but I'd rather do it separtely from fixing the issue at hand.

Signature · 3 lines
Regards,

Sakari Ailus
Reviewed-by
#3 lore raw
Quoted 9 lines · Sakari Ailus
Quoted 8 lines · Andy Shevchenko
Quoted 6 lines · Sakari Ailus

Disallow all private IOCTLs except ATOMISP_IOC_S_PARAMETERS. These aren't quite as safe as one could assume of IOCTL handlers; disable them for now. Instead of removing the code, simply check the IOCTL matches with S_PARAMETERS and bail out otherwise, in order to ease backporting.

In particular, ATOMISP_IOC_S_ISP_FPN_TABLE is disabled by this patch.

Quoted 8 lines
Quoted 2 lines

Why not removing the code?
It's still and will be in the Git index, it won't disappear.

There have been changes in the IOCTL handler over the supported kernel versions. This patch can be backported all the way down to v5.10.

I'm fine with removing the now-redundant code, but I'd rather do it separtely from fixing the issue at hand.

Fair enough,

Signature · 2 lines
With Best Regards,
Andy Shevchenko