[Bug 224037] Kernel crashes when trying to mount certain USB keys reported as WriteProtected

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Sun Dec 3 11:28:52 UTC 2017


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=224037

--- Comment #17 from Andriy Gapon <avg at FreeBSD.org> ---
(In reply to Petr Leszkow from comment #7)
I actually like the idea in this comment.
I think that we need to fix a bug that leads to the geom_vfs / buffer-cache
crash in any case.
It might be also nice to add the r/o mount fallback mechanism.

But on top of those things we could modify g_disk_access() to prevent the write
access altogether if a disk is in the write-protected mode.  We could either
add a new flag to flags in struct disk or, perhaps, a new parameter (open mode)
to d_open.
scsi_da could then use either WP bit (0x80) in the device-specific byte of the
mode parameter header (dev_spec field of scsi_mode_header_6 /
scsi_mode_header_10) or SWP bit (SCP_SWP) in the Control mode page (0x0A) that
we query at PROBE_MODE_SENSE stage.

I am not sufficiently fluent with CAM to implement the CAM (scsi_da) part.  The
geom_disk part is rather trivial, of course.

P.S.
It seems that scsi_sa.c already queries bit 7 in dev_spec, so that's an
example.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-scsi mailing list