Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [High] media: ipu6: resource leaks and list corruption on get_frame_desc failure --
commit ab555e23d2d582e2dd0f99a4cb6584f408d23edc Author: Sakari Ailus sakari.ailus@linux.intel.com
media: ipu6: Tell about not being able to obtain frame descriptor
Not being able to obtain a frame descriptor is a fatal error at this point. The frame descriptor should be stored for the duration of the streaming operation.
diff --git a/drivers/media/pci/intel/ipu6/ipu6-isys-csi2.c b/drivers/media/pci/intel/ipu6/ipu6-isys-csi2.c index 1525454279308..3e9bfda2a8b9a 100644 --- a/drivers/media/pci/intel/ipu6/ipu6-isys-csi2.c +++ b/drivers/media/pci/intel/ipu6/ipu6-isys-csi2.c @@ -749,8 +749,10 @@ static int ipu6_isys_csi2_disable_streams(struct v4l2_subdev *sd, lockdep_assert_held(&csi2->isys->stream_mutex);
ret = ipu6_isys_get_frame_desc(remote_sd, remote_pad->index, &desc);
- if (ret)
return ret;
- if (ret) {
dev_err(sd->dev, "cannot obtain frame descriptor\n");return 0;- }
[Severity: High] Does returning 0 here in ipu6_isys_csi2_disable_streams() instead of an error code mask the failure from the V4L2 core, leading to resource leaks and list corruption?
By returning 0, the V4L2 core updates its state to mark the stream as stopped, even though the hardware disablement and teardown steps have been bypassed.
This early return skips important cleanup such as pm_runtime_put(sd->dev), which leaks a PM reference count. It also skips list_del(&av->csi2_entry), leaving the video device's list entry linked in the csi2 list.
If a subsequent attempt is made to enable the stream, it will call list_add() on the already-linked node, which can corrupt the doubly-linked list. If the video device is freed, it could also result in a use-after-free when traversing the list.
While failing to clean up on error was preexisting, changing this to return 0 masks the failure and incorrectly signals success to the V4L2 core without fixing the teardown path.