|
|
@@ -179,12 +179,24 @@ static void bnx2fc_scsi_done(struct bnx2fc_cmd *io_req, int err_code)
|
|
|
|
|
|
bnx2fc_unmap_sg_list(io_req);
|
|
|
io_req->sc_cmd = NULL;
|
|
|
+
|
|
|
+ /* Sanity checks before returning command to mid-layer */
|
|
|
if (!sc_cmd) {
|
|
|
printk(KERN_ERR PFX "scsi_done - sc_cmd NULL. "
|
|
|
"IO(0x%x) already cleaned up\n",
|
|
|
io_req->xid);
|
|
|
return;
|
|
|
}
|
|
|
+ if (!sc_cmd->device) {
|
|
|
+ pr_err(PFX "0x%x: sc_cmd->device is NULL.\n", io_req->xid);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (!sc_cmd->device->host) {
|
|
|
+ pr_err(PFX "0x%x: sc_cmd->device->host is NULL.\n",
|
|
|
+ io_req->xid);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
sc_cmd->result = err_code << 16;
|
|
|
|
|
|
BNX2FC_IO_DBG(io_req, "sc=%p, result=0x%x, retries=%d, allowed=%d\n",
|