Hi Bart, On 2025/2/26 04:54, Bart Van Assche wrote:
Alan Stern has raised a related issue before. My take on this is outlined below.Has it been considered to truncate the MODE SENSE buffer to 192 bytes instead of rejecting the MODE SENSE command?
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);Link: https://lore.kernel.org/all/137902FEE03CCB3B+6130227f-9ddc-4043-9945-da465c28d9d1@xxxxxxxxxxxxx/
-- WangYuli
Attachment:
OpenPGP_0xC5DA1F3046F40BEE.asc
Description: OpenPGP public key
Attachment:
OpenPGP_signature.asc
Description: OpenPGP digital signature