[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <137902FEE03CCB3B+6130227f-9ddc-4043-9945-da465c28d9d1@uniontech.com>
Date: Fri, 7 Feb 2025 17:15:12 +0800
From: WangYuli <wangyuli@...ontech.com>
To: Alan Stern <stern@...land.harvard.edu>
Cc: gregkh@...uxfoundation.org, linux-usb@...r.kernel.org,
usb-storage@...ts.one-eyed-alien.net, linux-kernel@...r.kernel.org,
zhanjun@...ontech.com, guanwentao@...ontech.com, chenlinxuan@...ontech.com,
Xinwei Zhou <zhouxinwei@...ontech.com>, Xu Rao <raoxu@...ontech.com>,
Yujing Ming <mingyujing@...ontech.com>
Subject: Re: [PATCH] usb-storage: Bypass certain SCSI commands on disks with
"use_192_bytes_for_3f" attribute
On 2025/2/6 22:58, Alan Stern wrote:
> Is usb-storage really the right place to put this test? Wouldn't it
> be better to put it in the SCSI layer where the ioctl is converted to
> a SCSI command? That way it would affect all SCSI devices with the
> use_192_bytes_for_3f flag, not just USB devices.
Yes, yes...
This problem may occur not only in USB devices. It is more appropriate to modify it at the SCSI layer. I'll
send the patch v2 soon.
>
> Also, instead of making the command fail completely, wouldn't it be
> better to change the transfer length to 192 if the original value was
> larger?
But I personally think that it is not appropriate to modify it directly
to 192. After all, it is called by the user through ioctl, and the
kernel itself will not construct such a data frame. As shown in the
following code:
sd_read_write_protect_flag(struct scsi_disk *sdkp, unsigned char *buffer)
{
int res;
struct scsi_device *sdp = sdkp->device;
struct scsi_mode_data data;
int old_wp = sdkp->write_prot;
set_disk_ro(sdkp->disk, 0);
if (sdp->skip_ms_page_3f) {
sd_first_printk(KERN_NOTICE, sdkp, "Assuming Write Enabled\n");
return;
}
if (sdp->use_192_bytes_for_3f) {
res = sd_do_mode_sense(sdp, 0, 0x3F, buffer, 192, &data, NULL);
>
--
WangYuli
Content of type "text/html" skipped
Download attachment "OpenPGP_0xC5DA1F3046F40BEE.asc" of type "application/pgp-keys" (633 bytes)
Download attachment "OpenPGP_signature.asc" of type "application/pgp-signature" (237 bytes)
Powered by blists - more mailing lists