summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authormav <mav@FreeBSD.org>2013-06-12 09:07:15 +0000
committermav <mav@FreeBSD.org>2013-06-12 09:07:15 +0000
commit4c55deb67c82b785b387a6f4cd96d60b6abbf5ad (patch)
tree44006500cdefba5cd75abf164895a0e2f739bd4e /sys
parentda46948fb5a3bbb96e98e2bf40abf56ef29ea5b3 (diff)
downloadFreeBSD-src-4c55deb67c82b785b387a6f4cd96d60b6abbf5ad.zip
FreeBSD-src-4c55deb67c82b785b387a6f4cd96d60b6abbf5ad.tar.gz
Acquire periph reference when handling d_getattr() method call.
While GEOM in general has provider opened while sending BIO_GETATTR, GEOM DISK does not really need to open disk to read medium-unrelated attributes for own use. Proposed by: ken
Diffstat (limited to 'sys')
-rw-r--r--sys/cam/ata/ata_da.c3
-rw-r--r--sys/cam/scsi/scsi_da.c3
2 files changed, 6 insertions, 0 deletions
diff --git a/sys/cam/ata/ata_da.c b/sys/cam/ata/ata_da.c
index 0a4d4a3..e6ae5b2 100644
--- a/sys/cam/ata/ata_da.c
+++ b/sys/cam/ata/ata_da.c
@@ -1080,10 +1080,13 @@ adagetattr(struct bio *bp)
struct cam_periph *periph;
periph = (struct cam_periph *)bp->bio_disk->d_drv1;
+ if (cam_periph_acquire(periph) != CAM_REQ_CMP)
+ return (ENXIO);
cam_periph_lock(periph);
ret = xpt_getattr(bp->bio_data, bp->bio_length, bp->bio_attribute,
periph->path);
cam_periph_unlock(periph);
+ cam_periph_release(periph);
if (ret == 0)
bp->bio_completed = bp->bio_length;
return ret;
diff --git a/sys/cam/scsi/scsi_da.c b/sys/cam/scsi/scsi_da.c
index 76a16ea..bbbb0e1 100644
--- a/sys/cam/scsi/scsi_da.c
+++ b/sys/cam/scsi/scsi_da.c
@@ -1427,10 +1427,13 @@ dagetattr(struct bio *bp)
struct cam_periph *periph;
periph = (struct cam_periph *)bp->bio_disk->d_drv1;
+ if (cam_periph_acquire(periph) != CAM_REQ_CMP)
+ return (ENXIO);
cam_periph_lock(periph);
ret = xpt_getattr(bp->bio_data, bp->bio_length, bp->bio_attribute,
periph->path);
cam_periph_unlock(periph);
+ cam_periph_release(periph);
if (ret == 0)
bp->bio_completed = bp->bio_length;
return ret;
OpenPOWER on IntegriCloud