提交 62371e76 编写于 作者: Y Ye Bin 提交者: Yang Yingliang

Revert "scsi: check the whole result for reading write protect flag"

hulk inclusion
category: bugfix
bugzilla: NA
CVE: NA

-----------------------------------------------

This reverts commit e9e58048.
Signed-off-by: NYe Bin <yebin10@huawei.com>
Reviewed-by: NJason Yan <yanaijie@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 8a92b248
...@@ -2651,18 +2651,18 @@ sd_read_write_protect_flag(struct scsi_disk *sdkp, unsigned char *buffer) ...@@ -2651,18 +2651,18 @@ sd_read_write_protect_flag(struct scsi_disk *sdkp, unsigned char *buffer)
* 5: Illegal Request, Sense Code 24: Invalid field in * 5: Illegal Request, Sense Code 24: Invalid field in
* CDB. * CDB.
*/ */
if (!scsi_result_is_good(res)) if (!scsi_status_is_good(res))
res = sd_do_mode_sense(sdp, 0, 0, buffer, 4, &data, NULL); res = sd_do_mode_sense(sdp, 0, 0, buffer, 4, &data, NULL);
/* /*
* Third attempt: ask 255 bytes, as we did earlier. * Third attempt: ask 255 bytes, as we did earlier.
*/ */
if (!scsi_result_is_good(res)) if (!scsi_status_is_good(res))
res = sd_do_mode_sense(sdp, 0, 0x3F, buffer, 255, res = sd_do_mode_sense(sdp, 0, 0x3F, buffer, 255,
&data, NULL); &data, NULL);
} }
if (!scsi_result_is_good(res)) { if (!scsi_status_is_good(res)) {
sd_first_printk(KERN_WARNING, sdkp, sd_first_printk(KERN_WARNING, sdkp,
"Test WP failed, assume Write Enabled\n"); "Test WP failed, assume Write Enabled\n");
} else { } else {
......
...@@ -55,19 +55,6 @@ static inline int scsi_status_is_good(int status) ...@@ -55,19 +55,6 @@ static inline int scsi_status_is_good(int status)
(status == SAM_STAT_COMMAND_TERMINATED)); (status == SAM_STAT_COMMAND_TERMINATED));
} }
/** scsi_result_is_good - check the result return.
*
* @result: the result passed up from the driver (including host and
* driver components)
*
* Drivers may only set other bytes but not status byte.
* This checks both the status byte and other bytes.
*/
static inline int scsi_result_is_good(int result)
{
return scsi_status_is_good(result) && (result & ~0xff) == 0;
}
/* /*
* standard mode-select header prepended to all mode-select commands * standard mode-select header prepended to all mode-select commands
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册