Re: [Re: Linux 2.6.26-rc2] Write protect on on

From: Alan Stern
Date: Mon May 19 2008 - 15:17:37 EST


On Mon, 19 May 2008, Boaz Harrosh wrote:

> Sure, inspecting other places that emulate MODE_SENSE, (And inspecting the scsi
> spec) all zeros is a very good scsi response. Alan do you want to send a fix for all
> places that initiate a MODE_SENSE command, specifically at
> scsi_scan.c::scsi_unlock_floptical() ? (Some other places do)

I can't send such a fix because at these places the residue information
has already been lost. The fix needs to be made lower down.


Besides, everybody seems to be missing an important point.

MODE SENSE is just one example of a command for which a device might
return less data than the host expected. In principle the same thing
could happen with _any_ command. The host should be prepared for this
and should be able to handle it correctly. And the host shouldn't
blindly assume that devices will slavishly follow the letter of the
SCSI spec.

We need something much more thorough than just fiddling with
scsi_mode_sense(). One possibility would be to pass a
minimum-response-length argument to scsi_execute_req(). But even that
wouldn't catch all the code paths where this sort of thing could
happen (although it probably would catch most of them).

This needs someone who is more familiar than I am with the operation of
the SCSI core.

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/