Skip to content

media: i2c: ov02c10: Fix race condition and power sequence

Saikiran linux-arm-msm linux-media stable 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest2 patches 8 repliesIn review
  2. v33 patches 11 repliesSuperseded

Changes in v4 from the cover letter

- Dropped Patch 3 (Runtime PM Autosuspend) to separate platform-specific regulator fixes from generic driver cleanup.
- Modified Patch 2:
- Reduced reset assertion delay from 10ms to 5ms (usleep_range 5000-6000) to match datasheet specs and maintainer feedback.
- Removed the software reset (0x0103) and extra regulator delays to keep the sequence minimal and compliant.
- Patch 1 carried forward with Reviewed-by tag.

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2media: i2c: ov02c10: Fix use-after-free in remove functiondrivers/media/i2c/ov02c10.c+3 -30 replies
2/2media: i2c: ov02c10: Correct power-on sequence and timingdrivers/media/i2c/ov02c10.c+7 -38 replies

Reviews trailers per patch

1 of 2 patches has a Reviewed-by or Acked-by.

PatchHans de Goede
1/2R-b
2/2

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v4 thread

Cover letter [PATCH v4 0/2] media: i2c: ov02c10: Fix race condition and power sequence

This series addresses driver correctness and stability issues in the OV02C10 sensor driver. It fixes a use-after-free race condition during removal and aligns the power-on sequence with the datasheet requirements.

Note on v3/Brownouts:
The "Autosuspend" workaround proposed in v3 to handle regulator brownouts on Qualcomm X1E80100 platforms has been dropped from this series.

I am pursuing the root-cause analysis for the regulator discharge delays separately. The platform-specific constraints (2.3s passive discharge) will be handled via the regulator subsystem (linux-arm-msm) and device tree, keeping the media driver clean of platform-specific workarounds. I will continue investigating the underlying physical discharge characteristics and PMIC status registers as requested by maintainers.

This v4 series now strictly focuses on generic driver correctness:

Patch 1: Fixes a critical race condition in the remove() function where resources were freed while the device was potentially still active, leading to kernel oops.

Patch 2: Corrects the power-on sequence to strictly follow the datasheet timing (T1) by asserting the reset pin for 5ms before enabling power rails. This ensures the sensor enters a known clean state during cold boot.

Changes in v4:
- Dropped Patch 3 (Runtime PM Autosuspend) to separate platform-specific regulator fixes from generic driver cleanup.
- Modified Patch 2:
- Reduced reset assertion delay from 10ms to 5ms (usleep_range 5000-6000) to match datasheet specs and maintainer feedback.
- Removed the software reset (0x0103) and extra regulator delays to keep the sequence minimal and compliant.
- Patch 1 carried forward with Reviewed-by tag.

Changes in v3:
- Superseded previous "pipeline lock" and "brownout" series.
- Added strict power-on sequencing.
- Added fix for use-after-free in remove().

Saikiran (2):
media: i2c: ov02c10: Fix use-after-free in remove function
media: i2c: ov02c10: Correct power-on sequence and timing

 drivers/media/i2c/ov02c10.c | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)