]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
scsi_cd: Maintain a periph reference during media checks
authorMark Johnston <markj@FreeBSD.org>
Tue, 30 Jan 2024 01:01:12 +0000 (20:01 -0500)
committerMark Johnston <markj@FreeBSD.org>
Tue, 30 Jan 2024 14:24:55 +0000 (09:24 -0500)
commitc961afe82596bdeb7e6a8626f02ddb181c8a24b6
tree467e1425ca0119736631b831b66c4747729416ac
parentb1710124ff14f96db4c2a8fa37fc7c7b433fb176
scsi_cd: Maintain a periph reference during media checks

Otherwise nothing prevents the asynchronous media check state machine
from running after the periph has been destroyed, which can result in a
double free.  Acquire the reference even when performing a synchronous
check, since that doesn't hurt and keeps things simpler.

PR: 276251
Reviewed by: imp
Fixes: dd78f43259ef ("scsi_cd: make the media check asynchronous")
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D43525
sys/cam/scsi/scsi_cd.c