aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDouglas Gilbert <dgilbert@interlog.com>2014-11-24 23:04:47 -0500
committerChristoph Hellwig <hch@lst.de>2014-11-25 09:42:55 -0500
commit22017ed2de64b8f7a2ec0abe59dd6ca92f693391 (patch)
tree347a39e0f18b19b0dbaaa38b77b38d29d8a8c644
parent84021c90771b4582883900d19a52cdde1f453802 (diff)
scsi_debug: pinpoint invalid field in sense data
Use Sense Key Specific field in the sense data of an ILLEGAL REQUEST to optionally pinpoint the location of the problem field. This may be either in the cdb or the associated parameter list. Signed-off-by: Douglas Gilbert <dgilbert@interlog.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
-rw-r--r--drivers/scsi/scsi_debug.c138
1 files changed, 88 insertions, 50 deletions
diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index ce71b6d4393c..a1bca60ae83d 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -63,31 +63,34 @@
63#include "sd.h" 63#include "sd.h"
64#include "scsi_logging.h" 64#include "scsi_logging.h"
65 65
66#define SCSI_DEBUG_VERSION "1.84" 66#define SCSI_DEBUG_VERSION "1.85"
67static const char *scsi_debug_version_date = "20140706"; 67static const char *scsi_debug_version_date = "20141022";
68 68
69#define MY_NAME "scsi_debug" 69#define MY_NAME "scsi_debug"
70 70
71/* Additional Sense Code (ASC) */ 71/* Additional Sense Code (ASC) */
72#define NO_ADDITIONAL_SENSE 0x0 72#define NO_ADDITIONAL_SENSE 0x0
73#define LOGICAL_UNIT_NOT_READY 0x4 73#define LOGICAL_UNIT_NOT_READY 0x4
74#define LOGICAL_UNIT_COMMUNICATION_FAILURE 0x8
75#define UNRECOVERED_READ_ERR 0x11 74#define UNRECOVERED_READ_ERR 0x11
76#define PARAMETER_LIST_LENGTH_ERR 0x1a 75#define PARAMETER_LIST_LENGTH_ERR 0x1a
77#define INVALID_OPCODE 0x20 76#define INVALID_OPCODE 0x20
78#define ADDR_OUT_OF_RANGE 0x21
79#define INVALID_COMMAND_OPCODE 0x20 77#define INVALID_COMMAND_OPCODE 0x20
78#define LBA_OUT_OF_RANGE 0x21
80#define INVALID_FIELD_IN_CDB 0x24 79#define INVALID_FIELD_IN_CDB 0x24
81#define INVALID_FIELD_IN_PARAM_LIST 0x26 80#define INVALID_FIELD_IN_PARAM_LIST 0x26
82#define UA_RESET_ASC 0x29 81#define UA_RESET_ASC 0x29
83#define UA_CHANGED_ASC 0x2a 82#define UA_CHANGED_ASC 0x2a
83#define INSUFF_RES_ASC 0x55
84#define INSUFF_RES_ASCQ 0x3
84#define POWER_ON_RESET_ASCQ 0x0 85#define POWER_ON_RESET_ASCQ 0x0
85#define BUS_RESET_ASCQ 0x2 /* scsi bus reset occurred */ 86#define BUS_RESET_ASCQ 0x2 /* scsi bus reset occurred */
86#define MODE_CHANGED_ASCQ 0x1 /* mode parameters changed */ 87#define MODE_CHANGED_ASCQ 0x1 /* mode parameters changed */
88#define CAPACITY_CHANGED_ASCQ 0x9
87#define SAVING_PARAMS_UNSUP 0x39 89#define SAVING_PARAMS_UNSUP 0x39
88#define TRANSPORT_PROBLEM 0x4b 90#define TRANSPORT_PROBLEM 0x4b
89#define THRESHOLD_EXCEEDED 0x5d 91#define THRESHOLD_EXCEEDED 0x5d
90#define LOW_POWER_COND_ON 0x5e 92#define LOW_POWER_COND_ON 0x5e
93#define MISCOMPARE_VERIFY_ASC 0x1d
91 94
92/* Additional Sense Code Qualifier (ASCQ) */ 95/* Additional Sense Code Qualifier (ASCQ) */
93#define ACK_NAK_TO 0x3 96#define ACK_NAK_TO 0x3
@@ -394,6 +397,50 @@ static void sdebug_max_tgts_luns(void)
394 spin_unlock(&sdebug_host_list_lock); 397 spin_unlock(&sdebug_host_list_lock);
395} 398}
396 399
400enum sdeb_cmd_data {SDEB_IN_DATA = 0, SDEB_IN_CDB = 1};
401
402/* Set in_bit to -1 to indicate no bit position of invalid field */
403static void
404mk_sense_invalid_fld(struct scsi_cmnd *scp, enum sdeb_cmd_data c_d,
405 int in_byte, int in_bit)
406{
407 unsigned char *sbuff;
408 u8 sks[4];
409 int sl, asc;
410
411 sbuff = scp->sense_buffer;
412 if (!sbuff) {
413 sdev_printk(KERN_ERR, scp->device,
414 "%s: sense_buffer is NULL\n", __func__);
415 return;
416 }
417 asc = c_d ? INVALID_FIELD_IN_CDB : INVALID_FIELD_IN_PARAM_LIST;
418 memset(sbuff, 0, SCSI_SENSE_BUFFERSIZE);
419 scsi_build_sense_buffer(scsi_debug_dsense, sbuff, ILLEGAL_REQUEST,
420 asc, 0);
421 memset(sks, 0, sizeof(sks));
422 sks[0] = 0x80;
423 if (c_d)
424 sks[0] |= 0x40;
425 if (in_bit >= 0) {
426 sks[0] |= 0x8;
427 sks[0] |= 0x7 & in_bit;
428 }
429 put_unaligned_be16(in_byte, sks + 1);
430 if (scsi_debug_dsense) {
431 sl = sbuff[7] + 8;
432 sbuff[7] = sl;
433 sbuff[sl] = 0x2;
434 sbuff[sl + 1] = 0x6;
435 memcpy(sbuff + sl + 4, sks, 3);
436 } else
437 memcpy(sbuff + 15, sks, 3);
438 if (SCSI_DEBUG_OPT_NOISE & scsi_debug_opts)
439 sdev_printk(KERN_INFO, scp->device, "%s: [sense_key,asc,ascq"
440 "]: [0x5,0x%x,0x0] %c byte=%d, bit=%d\n",
441 my_name, asc, c_d ? 'C' : 'D', in_byte, in_bit);
442}
443
397static void mk_sense_buffer(struct scsi_cmnd *scp, int key, int asc, int asq) 444static void mk_sense_buffer(struct scsi_cmnd *scp, int key, int asc, int asq)
398{ 445{
399 unsigned char *sbuff; 446 unsigned char *sbuff;
@@ -414,6 +461,12 @@ static void mk_sense_buffer(struct scsi_cmnd *scp, int key, int asc, int asq)
414 my_name, key, asc, asq); 461 my_name, key, asc, asq);
415} 462}
416 463
464static void
465mk_sense_invalid_opcode(struct scsi_cmnd *scp)
466{
467 mk_sense_buffer(scp, ILLEGAL_REQUEST, INVALID_OPCODE, 0);
468}
469
417static void get_data_transfer_info(unsigned char *cmd, 470static void get_data_transfer_info(unsigned char *cmd,
418 unsigned long long *lba, unsigned int *num, 471 unsigned long long *lba, unsigned int *num,
419 u32 *ei_lba) 472 u32 *ei_lba)
@@ -944,8 +997,7 @@ static int resp_inquiry(struct scsi_cmnd *scp, int target,
944 pq_pdt = (scsi_debug_ptype & 0x1f); 997 pq_pdt = (scsi_debug_ptype & 0x1f);
945 arr[0] = pq_pdt; 998 arr[0] = pq_pdt;
946 if (0x2 & cmd[1]) { /* CMDDT bit set */ 999 if (0x2 & cmd[1]) { /* CMDDT bit set */
947 mk_sense_buffer(scp, ILLEGAL_REQUEST, INVALID_FIELD_IN_CDB, 1000 mk_sense_invalid_fld(scp, SDEB_IN_CDB, 1, 1);
948 0);
949 kfree(arr); 1001 kfree(arr);
950 return check_condition_result; 1002 return check_condition_result;
951 } else if (0x1 & cmd[1]) { /* EVPD bit set */ 1003 } else if (0x1 & cmd[1]) { /* EVPD bit set */
@@ -1029,9 +1081,7 @@ static int resp_inquiry(struct scsi_cmnd *scp, int target,
1029 arr[1] = cmd[2]; /*sanity */ 1081 arr[1] = cmd[2]; /*sanity */
1030 arr[3] = inquiry_evpd_b2(&arr[4]); 1082 arr[3] = inquiry_evpd_b2(&arr[4]);
1031 } else { 1083 } else {
1032 /* Illegal request, invalid field in cdb */ 1084 mk_sense_invalid_fld(scp, SDEB_IN_CDB, 2, -1);
1033 mk_sense_buffer(scp, ILLEGAL_REQUEST,
1034 INVALID_FIELD_IN_CDB, 0);
1035 kfree(arr); 1085 kfree(arr);
1036 return check_condition_result; 1086 return check_condition_result;
1037 } 1087 }
@@ -1123,8 +1173,7 @@ static int resp_start_stop(struct scsi_cmnd * scp,
1123 return errsts; 1173 return errsts;
1124 power_cond = (cmd[4] & 0xf0) >> 4; 1174 power_cond = (cmd[4] & 0xf0) >> 4;
1125 if (power_cond) { 1175 if (power_cond) {
1126 mk_sense_buffer(scp, ILLEGAL_REQUEST, INVALID_FIELD_IN_CDB, 1176 mk_sense_invalid_fld(scp, SDEB_IN_CDB, 4, 7);
1127 0);
1128 return check_condition_result; 1177 return check_condition_result;
1129 } 1178 }
1130 start = cmd[4] & 1; 1179 start = cmd[4] & 1;
@@ -1542,8 +1591,7 @@ static int resp_mode_sense(struct scsi_cmnd * scp, int target,
1542 1591
1543 if ((subpcode > 0x0) && (subpcode < 0xff) && (0x19 != pcode)) { 1592 if ((subpcode > 0x0) && (subpcode < 0xff) && (0x19 != pcode)) {
1544 /* TODO: Control Extension page */ 1593 /* TODO: Control Extension page */
1545 mk_sense_buffer(scp, ILLEGAL_REQUEST, INVALID_FIELD_IN_CDB, 1594 mk_sense_invalid_fld(scp, SDEB_IN_CDB, 3, -1);
1546 0);
1547 return check_condition_result; 1595 return check_condition_result;
1548 } 1596 }
1549 switch (pcode) { 1597 switch (pcode) {
@@ -1569,8 +1617,7 @@ static int resp_mode_sense(struct scsi_cmnd * scp, int target,
1569 break; 1617 break;
1570 case 0x19: /* if spc==1 then sas phy, control+discover */ 1618 case 0x19: /* if spc==1 then sas phy, control+discover */
1571 if ((subpcode > 0x2) && (subpcode < 0xff)) { 1619 if ((subpcode > 0x2) && (subpcode < 0xff)) {
1572 mk_sense_buffer(scp, ILLEGAL_REQUEST, 1620 mk_sense_invalid_fld(scp, SDEB_IN_CDB, 3, -1);
1573 INVALID_FIELD_IN_CDB, 0);
1574 return check_condition_result; 1621 return check_condition_result;
1575 } 1622 }
1576 len = 0; 1623 len = 0;
@@ -1602,15 +1649,13 @@ static int resp_mode_sense(struct scsi_cmnd * scp, int target,
1602 } 1649 }
1603 len += resp_iec_m_pg(ap + len, pcontrol, target); 1650 len += resp_iec_m_pg(ap + len, pcontrol, target);
1604 } else { 1651 } else {
1605 mk_sense_buffer(scp, ILLEGAL_REQUEST, 1652 mk_sense_invalid_fld(scp, SDEB_IN_CDB, 3, -1);
1606 INVALID_FIELD_IN_CDB, 0);
1607 return check_condition_result; 1653 return check_condition_result;
1608 } 1654 }
1609 offset += len; 1655 offset += len;
1610 break; 1656 break;
1611 default: 1657 default:
1612 mk_sense_buffer(scp, ILLEGAL_REQUEST, INVALID_FIELD_IN_CDB, 1658 mk_sense_invalid_fld(scp, SDEB_IN_CDB, 2, 5);
1613 0);
1614 return check_condition_result; 1659 return check_condition_result;
1615 } 1660 }
1616 if (msense_6) 1661 if (msense_6)
@@ -1640,8 +1685,7 @@ static int resp_mode_select(struct scsi_cmnd * scp, int mselect6,
1640 sp = cmd[1] & 0x1; 1685 sp = cmd[1] & 0x1;
1641 param_len = mselect6 ? cmd[4] : ((cmd[7] << 8) + cmd[8]); 1686 param_len = mselect6 ? cmd[4] : ((cmd[7] << 8) + cmd[8]);
1642 if ((0 == pf) || sp || (param_len > SDEBUG_MAX_MSELECT_SZ)) { 1687 if ((0 == pf) || sp || (param_len > SDEBUG_MAX_MSELECT_SZ)) {
1643 mk_sense_buffer(scp, ILLEGAL_REQUEST, 1688 mk_sense_invalid_fld(scp, SDEB_IN_CDB, mselect6 ? 4 : 7, -1);
1644 INVALID_FIELD_IN_CDB, 0);
1645 return check_condition_result; 1689 return check_condition_result;
1646 } 1690 }
1647 res = fetch_to_dev_buffer(scp, arr, param_len); 1691 res = fetch_to_dev_buffer(scp, arr, param_len);
@@ -1655,16 +1699,14 @@ static int resp_mode_select(struct scsi_cmnd * scp, int mselect6,
1655 md_len = mselect6 ? (arr[0] + 1) : ((arr[0] << 8) + arr[1] + 2); 1699 md_len = mselect6 ? (arr[0] + 1) : ((arr[0] << 8) + arr[1] + 2);
1656 bd_len = mselect6 ? arr[3] : ((arr[6] << 8) + arr[7]); 1700 bd_len = mselect6 ? arr[3] : ((arr[6] << 8) + arr[7]);
1657 if (md_len > 2) { 1701 if (md_len > 2) {
1658 mk_sense_buffer(scp, ILLEGAL_REQUEST, 1702 mk_sense_invalid_fld(scp, SDEB_IN_DATA, 0, -1);
1659 INVALID_FIELD_IN_PARAM_LIST, 0);
1660 return check_condition_result; 1703 return check_condition_result;
1661 } 1704 }
1662 off = bd_len + (mselect6 ? 4 : 8); 1705 off = bd_len + (mselect6 ? 4 : 8);
1663 mpage = arr[off] & 0x3f; 1706 mpage = arr[off] & 0x3f;
1664 ps = !!(arr[off] & 0x80); 1707 ps = !!(arr[off] & 0x80);
1665 if (ps) { 1708 if (ps) {
1666 mk_sense_buffer(scp, ILLEGAL_REQUEST, 1709 mk_sense_invalid_fld(scp, SDEB_IN_DATA, off, 7);
1667 INVALID_FIELD_IN_PARAM_LIST, 0);
1668 return check_condition_result; 1710 return check_condition_result;
1669 } 1711 }
1670 spf = !!(arr[off] & 0x40); 1712 spf = !!(arr[off] & 0x40);
@@ -1701,8 +1743,7 @@ static int resp_mode_select(struct scsi_cmnd * scp, int mselect6,
1701 default: 1743 default:
1702 break; 1744 break;
1703 } 1745 }
1704 mk_sense_buffer(scp, ILLEGAL_REQUEST, 1746 mk_sense_invalid_fld(scp, SDEB_IN_DATA, off, 5);
1705 INVALID_FIELD_IN_PARAM_LIST, 0);
1706 return check_condition_result; 1747 return check_condition_result;
1707set_mode_changed_ua: 1748set_mode_changed_ua:
1708 set_bit(SDEBUG_UA_MODE_CHANGED, devip->uas_bm); 1749 set_bit(SDEBUG_UA_MODE_CHANGED, devip->uas_bm);
@@ -1748,8 +1789,7 @@ static int resp_log_sense(struct scsi_cmnd * scp,
1748 ppc = cmd[1] & 0x2; 1789 ppc = cmd[1] & 0x2;
1749 sp = cmd[1] & 0x1; 1790 sp = cmd[1] & 0x1;
1750 if (ppc || sp) { 1791 if (ppc || sp) {
1751 mk_sense_buffer(scp, ILLEGAL_REQUEST, 1792 mk_sense_invalid_fld(scp, SDEB_IN_CDB, 1, ppc ? 1 : 0);
1752 INVALID_FIELD_IN_CDB, 0);
1753 return check_condition_result; 1793 return check_condition_result;
1754 } 1794 }
1755 pcontrol = (cmd[2] & 0xc0) >> 6; 1795 pcontrol = (cmd[2] & 0xc0) >> 6;
@@ -1773,8 +1813,7 @@ static int resp_log_sense(struct scsi_cmnd * scp,
1773 arr[3] = resp_ie_l_pg(arr + 4); 1813 arr[3] = resp_ie_l_pg(arr + 4);
1774 break; 1814 break;
1775 default: 1815 default:
1776 mk_sense_buffer(scp, ILLEGAL_REQUEST, 1816 mk_sense_invalid_fld(scp, SDEB_IN_CDB, 2, 5);
1777 INVALID_FIELD_IN_CDB, 0);
1778 return check_condition_result; 1817 return check_condition_result;
1779 } 1818 }
1780 } else if (0xff == subpcode) { 1819 } else if (0xff == subpcode) {
@@ -1806,13 +1845,11 @@ static int resp_log_sense(struct scsi_cmnd * scp,
1806 arr[3] = n - 4; 1845 arr[3] = n - 4;
1807 break; 1846 break;
1808 default: 1847 default:
1809 mk_sense_buffer(scp, ILLEGAL_REQUEST, 1848 mk_sense_invalid_fld(scp, SDEB_IN_CDB, 2, 5);
1810 INVALID_FIELD_IN_CDB, 0);
1811 return check_condition_result; 1849 return check_condition_result;
1812 } 1850 }
1813 } else { 1851 } else {
1814 mk_sense_buffer(scp, ILLEGAL_REQUEST, 1852 mk_sense_invalid_fld(scp, SDEB_IN_CDB, 3, -1);
1815 INVALID_FIELD_IN_CDB, 0);
1816 return check_condition_result; 1853 return check_condition_result;
1817 } 1854 }
1818 len = min(((arr[2] << 8) + arr[3]) + 4, alloc_len); 1855 len = min(((arr[2] << 8) + arr[3]) + 4, alloc_len);
@@ -1824,11 +1861,12 @@ static int check_device_access_params(struct scsi_cmnd *scp,
1824 unsigned long long lba, unsigned int num) 1861 unsigned long long lba, unsigned int num)
1825{ 1862{
1826 if (lba + num > sdebug_capacity) { 1863 if (lba + num > sdebug_capacity) {
1827 mk_sense_buffer(scp, ILLEGAL_REQUEST, ADDR_OUT_OF_RANGE, 0); 1864 mk_sense_buffer(scp, ILLEGAL_REQUEST, LBA_OUT_OF_RANGE, 0);
1828 return check_condition_result; 1865 return check_condition_result;
1829 } 1866 }
1830 /* transfer length excessive (tie in to block limits VPD page) */ 1867 /* transfer length excessive (tie in to block limits VPD page) */
1831 if (num > sdebug_store_sectors) { 1868 if (num > sdebug_store_sectors) {
1869 /* needs work to find which cdb byte 'num' comes from */
1832 mk_sense_buffer(scp, ILLEGAL_REQUEST, INVALID_FIELD_IN_CDB, 0); 1870 mk_sense_buffer(scp, ILLEGAL_REQUEST, INVALID_FIELD_IN_CDB, 0);
1833 return check_condition_result; 1871 return check_condition_result;
1834 } 1872 }
@@ -2412,8 +2450,8 @@ static int resp_report_luns(struct scsi_cmnd * scp,
2412 struct sdebug_dev_info * devip) 2450 struct sdebug_dev_info * devip)
2413{ 2451{
2414 unsigned int alloc_len; 2452 unsigned int alloc_len;
2415 int lun_cnt, i, upper, num, n; 2453 int lun_cnt, i, upper, num, n, want_wlun, shortish;
2416 u64 wlun, lun; 2454 u64 lun;
2417 unsigned char *cmd = scp->cmnd; 2455 unsigned char *cmd = scp->cmnd;
2418 int select_report = (int)cmd[2]; 2456 int select_report = (int)cmd[2];
2419 struct scsi_lun *one_lun; 2457 struct scsi_lun *one_lun;
@@ -2421,9 +2459,9 @@ static int resp_report_luns(struct scsi_cmnd * scp,
2421 unsigned char * max_addr; 2459 unsigned char * max_addr;
2422 2460
2423 alloc_len = cmd[9] + (cmd[8] << 8) + (cmd[7] << 16) + (cmd[6] << 24); 2461 alloc_len = cmd[9] + (cmd[8] << 8) + (cmd[7] << 16) + (cmd[6] << 24);
2424 if ((alloc_len < 4) || (select_report > 2)) { 2462 shortish = (alloc_len < 4);
2425 mk_sense_buffer(scp, ILLEGAL_REQUEST, INVALID_FIELD_IN_CDB, 2463 if (shortish || (select_report > 2)) {
2426 0); 2464 mk_sense_invalid_fld(scp, SDEB_IN_CDB, shortish ? 6 : 2, -1);
2427 return check_condition_result; 2465 return check_condition_result;
2428 } 2466 }
2429 /* can produce response with up to 16k luns (lun 0 to lun 16383) */ 2467 /* can produce response with up to 16k luns (lun 0 to lun 16383) */
@@ -2433,14 +2471,14 @@ static int resp_report_luns(struct scsi_cmnd * scp,
2433 lun_cnt = 0; 2471 lun_cnt = 0;
2434 else if (scsi_debug_no_lun_0 && (lun_cnt > 0)) 2472 else if (scsi_debug_no_lun_0 && (lun_cnt > 0))
2435 --lun_cnt; 2473 --lun_cnt;
2436 wlun = (select_report > 0) ? 1 : 0; 2474 want_wlun = (select_report > 0) ? 1 : 0;
2437 num = lun_cnt + wlun; 2475 num = lun_cnt + want_wlun;
2438 arr[2] = ((sizeof(struct scsi_lun) * num) >> 8) & 0xff; 2476 arr[2] = ((sizeof(struct scsi_lun) * num) >> 8) & 0xff;
2439 arr[3] = (sizeof(struct scsi_lun) * num) & 0xff; 2477 arr[3] = (sizeof(struct scsi_lun) * num) & 0xff;
2440 n = min((int)((SDEBUG_RLUN_ARR_SZ - 8) / 2478 n = min((int)((SDEBUG_RLUN_ARR_SZ - 8) /
2441 sizeof(struct scsi_lun)), num); 2479 sizeof(struct scsi_lun)), num);
2442 if (n < num) { 2480 if (n < num) {
2443 wlun = 0; 2481 want_wlun = 0;
2444 lun_cnt = n; 2482 lun_cnt = n;
2445 } 2483 }
2446 one_lun = (struct scsi_lun *) &arr[8]; 2484 one_lun = (struct scsi_lun *) &arr[8];
@@ -2454,7 +2492,7 @@ static int resp_report_luns(struct scsi_cmnd * scp,
2454 (upper | (SAM2_LUN_ADDRESS_METHOD << 6)); 2492 (upper | (SAM2_LUN_ADDRESS_METHOD << 6));
2455 one_lun[i].scsi_lun[1] = lun & 0xff; 2493 one_lun[i].scsi_lun[1] = lun & 0xff;
2456 } 2494 }
2457 if (wlun) { 2495 if (want_wlun) {
2458 one_lun[i].scsi_lun[0] = (SAM2_WLUN_REPORT_LUNS >> 8) & 0xff; 2496 one_lun[i].scsi_lun[0] = (SAM2_WLUN_REPORT_LUNS >> 8) & 0xff;
2459 one_lun[i].scsi_lun[1] = SAM2_WLUN_REPORT_LUNS & 0xff; 2497 one_lun[i].scsi_lun[1] = SAM2_WLUN_REPORT_LUNS & 0xff;
2460 i++; 2498 i++;
@@ -2476,8 +2514,8 @@ static int resp_xdwriteread(struct scsi_cmnd *scp, unsigned long long lba,
2476 /* better not to use temporary buffer. */ 2514 /* better not to use temporary buffer. */
2477 buf = kmalloc(scsi_bufflen(scp), GFP_ATOMIC); 2515 buf = kmalloc(scsi_bufflen(scp), GFP_ATOMIC);
2478 if (!buf) { 2516 if (!buf) {
2479 mk_sense_buffer(scp, NOT_READY, 2517 mk_sense_buffer(scp, ILLEGAL_REQUEST, INSUFF_RES_ASC,
2480 LOGICAL_UNIT_COMMUNICATION_FAILURE, 0); 2518 INSUFF_RES_ASCQ);
2481 return check_condition_result; 2519 return check_condition_result;
2482 } 2520 }
2483 2521
@@ -4555,9 +4593,9 @@ static struct scsi_host_template sdebug_driver_template = {
4555 4593
4556static int sdebug_driver_probe(struct device * dev) 4594static int sdebug_driver_probe(struct device * dev)
4557{ 4595{
4558 int error = 0; 4596 int error = 0;
4559 struct sdebug_host_info *sdbg_host; 4597 struct sdebug_host_info *sdbg_host;
4560 struct Scsi_Host *hpnt; 4598 struct Scsi_Host *hpnt;
4561 int host_prot; 4599 int host_prot;
4562 4600
4563 sdbg_host = to_sdebug_host(dev); 4601 sdbg_host = to_sdebug_host(dev);