Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 62b084ce authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "scsi: sd: Avoid sending medium write commands if device is write protected"

parents b1733294 1a340d8b
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -169,7 +169,7 @@ sd_store_cache_type(struct device *dev, struct device_attribute *attr,
	if (ct < 0)
		return -EINVAL;
	rcd = ct & 0x01 ? 1 : 0;
	wce = ct & 0x02 ? 1 : 0;
	wce = (ct & 0x02) && !sdkp->write_prot ? 1 : 0;

	if (sdkp->cache_override) {
		sdkp->WCE = wce;
@@ -2438,6 +2438,10 @@ sd_read_cache_type(struct scsi_disk *sdkp, unsigned char *buffer)
			sdkp->DPOFUA = 0;
		}

		/* No cache flush allowed for write protected devices */
		if (sdkp->WCE && sdkp->write_prot)
			sdkp->WCE = 0;

		if (sdkp->first_scan || old_wce != sdkp->WCE ||
		    old_rcd != sdkp->RCD || old_dpofua != sdkp->DPOFUA)
			sd_printk(KERN_NOTICE, sdkp,