]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/commit
MFC r327996: geom_disk / scsi_da: deny opening write-protected disks for writing
authoravg <avg@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Thu, 15 Feb 2018 16:31:35 +0000 (16:31 +0000)
committeravg <avg@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Thu, 15 Feb 2018 16:31:35 +0000 (16:31 +0000)
commit6869575740de369db3781a14da9bd0478c39ac9c
tree034758b15128427ddc3290405ce82363f121389a
parent657242eeafa4d2404bbda1e4bc7740f21d1b6b0f
MFC r327996: geom_disk / scsi_da: deny opening write-protected disks for writing

Ths change consists of two parts.

geom_disk: deny opening a disk for writing if it's marked as
write-protected.  A new disk(9) flag is added to mark write protected
disks.  A possible alternative could be to add another parameter to d_open,
so that the open mode could be passed to it and the disk drivers could
make the decision internally, but the flag required less churn.

scsi_da: add a new phase of disk probing to query the all pages mode
sense page.  We can determine if the disk is write protected using bit 7
of the device specific field in the mode parameter header returned by
MODE SENSE.

PR: 224037

git-svn-id: svn://svn.freebsd.org/base/stable/10@329319 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
sys/cam/scsi/scsi_da.c
sys/geom/geom_disk.c
sys/geom/geom_disk.h