diff options
author | mav <mav@FreeBSD.org> | 2014-01-11 13:35:36 +0000 |
---|---|---|
committer | mav <mav@FreeBSD.org> | 2014-01-11 13:35:36 +0000 |
commit | d2c6e514d823765383bdbb9b8c12abd86f3bf3bf (patch) | |
tree | d46e8d3936f461a06f4383f6bed0a896564b5846 /sys/cam/cam_periph.c | |
parent | 436cff738fbf01d4d8854e03ed88c91850926103 (diff) | |
download | FreeBSD-src-d2c6e514d823765383bdbb9b8c12abd86f3bf3bf.zip FreeBSD-src-d2c6e514d823765383bdbb9b8c12abd86f3bf3bf.tar.gz |
Take additional reference on SCSI probe periph to cover its freeze count.
Otherwise periph may be invalidated and freed before single-stepping freeze
is dropped, causing use after free panic.
Diffstat (limited to 'sys/cam/cam_periph.c')
-rw-r--r-- | sys/cam/cam_periph.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/sys/cam/cam_periph.c b/sys/cam/cam_periph.c index 1c636cb..ef67c79 100644 --- a/sys/cam/cam_periph.c +++ b/sys/cam/cam_periph.c @@ -376,6 +376,17 @@ cam_periph_acquire(struct cam_periph *periph) } void +cam_periph_doacquire(struct cam_periph *periph) +{ + + xpt_lock_buses(); + KASSERT(periph->refcount >= 1, + ("cam_periph_doacquire() with refcount == %d", periph->refcount)); + periph->refcount++; + xpt_unlock_buses(); +} + +void cam_periph_release_locked_buses(struct cam_periph *periph) { |