aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-07-11 15:51:58 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-07-11 15:51:58 -0400
commit5f8ebd36f7dd95ec97aec82d5907522dc54e85ba (patch)
treea7e06eea7e285b88ae9c7bb03b0b036b52d0ee03 /include
parent8a76e5383fb5f58868fdd3a2fe1f4b95988f10a8 (diff)
parenta77171806515fb5e2288219ddb47af1f0b1328e7 (diff)
Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Pull SCSI fixes from James Bottomley: "This is a set of three fixes for data corruption (libsas task file), oops causing (NULL in scsi_cmd_to_driver) and driver failure (bnx2i). The oops caused by the NULL in scsi_cmd_to_driver() manifests in scsi_eh_send_cmd() and has been seen by several people now. Signed-off-by: James Bottomley <JBottomley@Parallels.com>" * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: [SCSI] bnx2i: Removed the reference to the netdev->base_addr [SCSI] libsas: fix taskfile corruption in sas_ata_qc_fill_rtf [SCSI] Fix NULL dereferences in scsi_cmd_to_driver
Diffstat (limited to 'include')
-rw-r--r--include/scsi/libsas.h6
-rw-r--r--include/scsi/scsi_cmnd.h8
2 files changed, 11 insertions, 3 deletions
diff --git a/include/scsi/libsas.h b/include/scsi/libsas.h
index f4f1c96dca72..10ce74f589c5 100644
--- a/include/scsi/libsas.h
+++ b/include/scsi/libsas.h
@@ -163,6 +163,8 @@ enum ata_command_set {
163 ATAPI_COMMAND_SET = 1, 163 ATAPI_COMMAND_SET = 1,
164}; 164};
165 165
166#define ATA_RESP_FIS_SIZE 24
167
166struct sata_device { 168struct sata_device {
167 enum ata_command_set command_set; 169 enum ata_command_set command_set;
168 struct smp_resp rps_resp; /* report_phy_sata_resp */ 170 struct smp_resp rps_resp; /* report_phy_sata_resp */
@@ -171,7 +173,7 @@ struct sata_device {
171 173
172 struct ata_port *ap; 174 struct ata_port *ap;
173 struct ata_host ata_host; 175 struct ata_host ata_host;
174 struct ata_taskfile tf; 176 u8 fis[ATA_RESP_FIS_SIZE];
175}; 177};
176 178
177enum { 179enum {
@@ -537,7 +539,7 @@ enum exec_status {
537 */ 539 */
538struct ata_task_resp { 540struct ata_task_resp {
539 u16 frame_len; 541 u16 frame_len;
540 u8 ending_fis[24]; /* dev to host or data-in */ 542 u8 ending_fis[ATA_RESP_FIS_SIZE]; /* dev to host or data-in */
541}; 543};
542 544
543#define SAS_STATUS_BUF_SIZE 96 545#define SAS_STATUS_BUF_SIZE 96
diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h
index 1e1198546c72..ac06cc595890 100644
--- a/include/scsi/scsi_cmnd.h
+++ b/include/scsi/scsi_cmnd.h
@@ -134,10 +134,16 @@ struct scsi_cmnd {
134 134
135static inline struct scsi_driver *scsi_cmd_to_driver(struct scsi_cmnd *cmd) 135static inline struct scsi_driver *scsi_cmd_to_driver(struct scsi_cmnd *cmd)
136{ 136{
137 struct scsi_driver **sdp;
138
137 if (!cmd->request->rq_disk) 139 if (!cmd->request->rq_disk)
138 return NULL; 140 return NULL;
139 141
140 return *(struct scsi_driver **)cmd->request->rq_disk->private_data; 142 sdp = (struct scsi_driver **)cmd->request->rq_disk->private_data;
143 if (!sdp)
144 return NULL;
145
146 return *sdp;
141} 147}
142 148
143extern struct scsi_cmnd *scsi_get_command(struct scsi_device *, gfp_t); 149extern struct scsi_cmnd *scsi_get_command(struct scsi_device *, gfp_t);