From owner-freebsd-scsi@freebsd.org Sun Dec 3 11:28:52 2017 Return-Path: Delivered-To: freebsd-scsi@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8452EDF8097 for ; Sun, 3 Dec 2017 11:28:52 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 722DC754A5 for ; Sun, 3 Dec 2017 11:28:52 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from bugs.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id vB3BSotV057179 for ; Sun, 3 Dec 2017 11:28:52 GMT (envelope-from bugzilla-noreply@freebsd.org) 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 Date: Sun, 03 Dec 2017 11:28:51 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: 11.1-STABLE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: avg@FreeBSD.org X-Bugzilla-Status: Closed X-Bugzilla-Resolution: DUPLICATE X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: freebsd-scsi@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-scsi@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SCSI subsystem List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Dec 2017 11:28:52 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D224037 --- Comment #17 from Andriy Gapon --- (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.=