From 951f53d9a9000dd661b9db7167929ec50d245856 Mon Sep 17 00:00:00 2001 From: "elel@3wh.net" Date: Mon, 24 Dec 2018 21:52:48 +0000 Subject: [PATCH 3/5] Remove hard-coded denial of ro attr change for SD --- drivers/scsi/sd.c | 9 ++------- drivers/scsi/ufs/ufs-exynos.h | 1 + 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index c01742258ac4..dae2cdb1b797 100755 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -1280,11 +1280,6 @@ static int sd_ioctl(struct block_device *bdev, fmode_t mode, SCSI_LOG_IOCTL(1, sd_printk(KERN_INFO, sdkp, "sd_ioctl: disk=%s, " "cmd=0x%x\n", disk->disk_name, cmd)); - /* Forbid setting device's ro attribute */ - if (cmd == BLKROSET) { - return -EACCES; - } - error = scsi_verify_blk_ioctl(bdev, cmd); if (error < 0) return error; @@ -2261,7 +2256,7 @@ sd_read_write_protect_flag(struct scsi_disk *sdkp, unsigned char *buffer) struct scsi_mode_data data; int old_wp = sdkp->write_prot; - //set_disk_ro(sdkp->disk, 0); + set_disk_ro(sdkp->disk, 0); if (sdp->skip_ms_page_3f) { sd_printk(KERN_NOTICE, sdkp, "Assuming Write Enabled\n"); return; @@ -2299,7 +2294,7 @@ sd_read_write_protect_flag(struct scsi_disk *sdkp, unsigned char *buffer) "Test WP failed, assume Write Enabled\n"); } else { sdkp->write_prot = ((data.device_specific & 0x80) != 0); - //set_disk_ro(sdkp->disk, sdkp->write_prot); + set_disk_ro(sdkp->disk, sdkp->write_prot); if (sdkp->first_scan || old_wp != sdkp->write_prot) { sd_printk(KERN_NOTICE, sdkp, "Write Protect is %s\n", sdkp->write_prot ? "on" : "off"); diff --git a/drivers/scsi/ufs/ufs-exynos.h b/drivers/scsi/ufs/ufs-exynos.h index 43edc4b92eb5..70fbf39408be 100644 --- a/drivers/scsi/ufs/ufs-exynos.h +++ b/drivers/scsi/ufs/ufs-exynos.h @@ -511,4 +511,5 @@ struct ufs_attr_log { u32 res; u32 val; }; + #endif /* _UFS_EXYNOS_H_ */ -- 2.20.1