Skip to content

Commit ffb9072

Browse files
bingbucaoHans Verkuil
authored andcommitted
media: intel/ipu6: add csi2 port sanity check in notifier bound
Invalid csi2 port will break the isys notifier bound ops as it is trying to access an invalid csi2 sub-device instance based on the port. It will trigger a mc warning, and it will cause the sensor driver to unbound an inexistent isys csi2 and crash. Adding a csi2 port sanity check, return error to avoid such case. Fixes: f50c4ca ("media: intel/ipu6: add the main input system driver") Signed-off-by: Bingbu Cao <[email protected]> [Sakari Ailus: Fix spelling of "nports" field.] Signed-off-by: Sakari Ailus <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
1 parent 5488079 commit ffb9072

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

drivers/media/pci/intel/ipu6/ipu6-isys.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -678,6 +678,12 @@ static int isys_notifier_bound(struct v4l2_async_notifier *notifier,
678678
container_of(asc, struct sensor_async_sd, asc);
679679
int ret;
680680

681+
if (s_asd->csi2.port >= isys->pdata->ipdata->csi2.nports) {
682+
dev_err(&isys->adev->auxdev.dev, "invalid csi2 port %u\n",
683+
s_asd->csi2.port);
684+
return -EINVAL;
685+
}
686+
681687
ret = ipu_bridge_instantiate_vcm(sd->dev);
682688
if (ret) {
683689
dev_err(&isys->adev->auxdev.dev, "instantiate vcm failed\n");

0 commit comments

Comments
 (0)