[PATCH v5 02/58] mtd: acquire an MTD handle from a referenced class device
sashiko-bot at kernel.org
sashiko-bot at kernel.org
Sun Nov 15 22:59:01 PST 2026
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] ptp: ocp: missing Fixes trailer for ptp_ocp_devlink_flash() bug
fix
--
commit e1b6d6f0f64e0ad9ed8cad4e452f22b6c29bfbc9
Author: James Hilliard <james.hilliard1 at gmail.com>
> mtd: acquire an MTD handle from a referenced class device
>
> PTP OCP locates flash through the device hierarchy and uses driver data
> directly. A class-device reference does not keep an MTD registered or own
> the backing object needed by an erase or write.
>
> Look up the exact device under mtd_table_mutex and acquire an ordinary MTD
> handle before returning it. Use that handle for the OCP update and release
> it on every exit. A removed device cannot be confused with a replacement
> that reuses its name or number.
>
> Cc: Richard Cochran <richardcochran at gmail.com>
> Cc: Jonathan Lemon <jonathan.lemon at gmail.com>
> Cc: Vadim Fedorenko <vadim.fedorenko at linux.dev>
> Signed-off-by: James Hilliard <james.hilliard1 at gmail.com>
[Severity: Low]
This fixes a lifetime and reference-counting bug in
ptp_ocp_devlink_flash() where dev_get_drvdata(dev) was used directly
without acquiring an MTD device reference. Should the commit message
include:
Fixes: 773bda964921 ("ptp: ocp: Expose various resources on the timecard.")
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261115-submit-rawnand-retained-handle-lifetime-v1-v5-0-cbc49c5c5e74@gmail.com?part=2
More information about the linux-mtd
mailing list