Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 03 Dec 2017 11:28:51 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-scsi@FreeBSD.org
Subject:   [Bug 224037] Kernel crashes when trying to  mount certain USB keys reported as WriteProtected
Message-ID:  <bug-224037-5312-yFpkC6TGC8@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-224037-5312@https.bugs.freebsd.org/bugzilla/>
References:  <bug-224037-5312@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D224037

--- Comment #17 from Andriy Gapon <avg@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 w=
rite
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 m=
ode)
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) t=
hat
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.

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-224037-5312-yFpkC6TGC8>