diff options
author | Anirban Chakraborty <anirban.chakraborty@qlogic.com> | 2009-06-03 12:55:19 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2009-06-08 15:46:44 -0400 |
commit | 59e0b8b088031b3b751f0608f797f2581f49a827 (patch) | |
tree | 8c1c5c84c3e86abfe9ea1bda8516988b2a8a02e2 /drivers/scsi | |
parent | 94b3aa47ac1ea0aa31b3f59ad121cdf55e038594 (diff) |
[SCSI] qla2xxx: Correct NULL pointer bug in cpu affinity mode.
This patch fixes a NULL pointer bug that occurs when IO is being
carried out on a vport for which the cpu affinity mode is turned on.
Signed-off-by: Anirban Chakraborty <anirban.chakraborty@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/qla2xxx/qla_attr.c | 15 | ||||
-rw-r--r-- | drivers/scsi/qla2xxx/qla_iocb.c | 16 |
2 files changed, 16 insertions, 15 deletions
diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c index 2bd017ffb084..74e69703ef98 100644 --- a/drivers/scsi/qla2xxx/qla_attr.c +++ b/drivers/scsi/qla2xxx/qla_attr.c | |||
@@ -1595,6 +1595,7 @@ qla24xx_vport_create(struct fc_vport *fc_vport, bool disable) | |||
1595 | struct qla_hw_data *ha = base_vha->hw; | 1595 | struct qla_hw_data *ha = base_vha->hw; |
1596 | uint16_t options = 0; | 1596 | uint16_t options = 0; |
1597 | int cnt; | 1597 | int cnt; |
1598 | struct req_que *req = ha->req_q_map[0]; | ||
1598 | 1599 | ||
1599 | ret = qla24xx_vport_create_req_sanity_check(fc_vport); | 1600 | ret = qla24xx_vport_create_req_sanity_check(fc_vport); |
1600 | if (ret) { | 1601 | if (ret) { |
@@ -1650,14 +1651,16 @@ qla24xx_vport_create(struct fc_vport *fc_vport, bool disable) | |||
1650 | 1651 | ||
1651 | qla24xx_vport_disable(fc_vport, disable); | 1652 | qla24xx_vport_disable(fc_vport, disable); |
1652 | 1653 | ||
1653 | ret = 0; | 1654 | if (ql2xmultique_tag) { |
1654 | if (ql2xmaxqueues == 1 || ql2xmultique_tag || !ha->npiv_info) | 1655 | req = ha->req_q_map[1]; |
1656 | goto vport_queue; | ||
1657 | } else if (ql2xmaxqueues == 1 || !ha->npiv_info) | ||
1655 | goto vport_queue; | 1658 | goto vport_queue; |
1656 | /* Create a request queue in QoS mode for the vport */ | 1659 | /* Create a request queue in QoS mode for the vport */ |
1657 | for (cnt = 0; cnt < ha->nvram_npiv_size; cnt++) { | 1660 | for (cnt = 0; cnt < ha->nvram_npiv_size; cnt++) { |
1658 | if (memcmp(ha->npiv_info[cnt].port_name, vha->port_name, 8) == 0 | 1661 | if (memcmp(ha->npiv_info[cnt].port_name, vha->port_name, 8) == 0 |
1659 | && memcmp(ha->npiv_info[cnt].node_name, vha->node_name, | 1662 | && memcmp(ha->npiv_info[cnt].node_name, vha->node_name, |
1660 | 8) == 0) { | 1663 | 8) == 0) { |
1661 | qos = ha->npiv_info[cnt].q_qos; | 1664 | qos = ha->npiv_info[cnt].q_qos; |
1662 | break; | 1665 | break; |
1663 | } | 1666 | } |
@@ -1669,14 +1672,16 @@ qla24xx_vport_create(struct fc_vport *fc_vport, bool disable) | |||
1669 | qla_printk(KERN_WARNING, ha, | 1672 | qla_printk(KERN_WARNING, ha, |
1670 | "Can't create request queue for vp_idx:%d\n", | 1673 | "Can't create request queue for vp_idx:%d\n", |
1671 | vha->vp_idx); | 1674 | vha->vp_idx); |
1672 | else | 1675 | else { |
1673 | DEBUG2(qla_printk(KERN_INFO, ha, | 1676 | DEBUG2(qla_printk(KERN_INFO, ha, |
1674 | "Request Que:%d (QoS: %d) created for vp_idx:%d\n", | 1677 | "Request Que:%d (QoS: %d) created for vp_idx:%d\n", |
1675 | ret, qos, vha->vp_idx)); | 1678 | ret, qos, vha->vp_idx)); |
1679 | req = ha->req_q_map[ret]; | ||
1680 | } | ||
1676 | } | 1681 | } |
1677 | 1682 | ||
1678 | vport_queue: | 1683 | vport_queue: |
1679 | vha->req = ha->req_q_map[ret]; | 1684 | vha->req = req; |
1680 | return 0; | 1685 | return 0; |
1681 | 1686 | ||
1682 | vport_create_failed_2: | 1687 | vport_create_failed_2: |
diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c index b4c6010ee5fa..13396beae2ce 100644 --- a/drivers/scsi/qla2xxx/qla_iocb.c +++ b/drivers/scsi/qla2xxx/qla_iocb.c | |||
@@ -15,7 +15,7 @@ static request_t *qla2x00_req_pkt(struct scsi_qla_host *, struct req_que *, | |||
15 | struct rsp_que *rsp); | 15 | struct rsp_que *rsp); |
16 | static void qla2x00_isp_cmd(struct scsi_qla_host *, struct req_que *); | 16 | static void qla2x00_isp_cmd(struct scsi_qla_host *, struct req_que *); |
17 | 17 | ||
18 | static void qla25xx_set_que(srb_t *, struct req_que **, struct rsp_que **); | 18 | static void qla25xx_set_que(srb_t *, struct rsp_que **); |
19 | /** | 19 | /** |
20 | * qla2x00_get_cmd_direction() - Determine control_flag data direction. | 20 | * qla2x00_get_cmd_direction() - Determine control_flag data direction. |
21 | * @cmd: SCSI command | 21 | * @cmd: SCSI command |
@@ -722,7 +722,8 @@ qla24xx_start_scsi(srb_t *sp) | |||
722 | /* Setup device pointers. */ | 722 | /* Setup device pointers. */ |
723 | ret = 0; | 723 | ret = 0; |
724 | 724 | ||
725 | qla25xx_set_que(sp, &req, &rsp); | 725 | qla25xx_set_que(sp, &rsp); |
726 | req = vha->req; | ||
726 | 727 | ||
727 | /* So we know we haven't pci_map'ed anything yet */ | 728 | /* So we know we haven't pci_map'ed anything yet */ |
728 | tot_dsds = 0; | 729 | tot_dsds = 0; |
@@ -845,20 +846,15 @@ queuing_error: | |||
845 | return QLA_FUNCTION_FAILED; | 846 | return QLA_FUNCTION_FAILED; |
846 | } | 847 | } |
847 | 848 | ||
848 | static void qla25xx_set_que(srb_t *sp, struct req_que **req, | 849 | static void qla25xx_set_que(srb_t *sp, struct rsp_que **rsp) |
849 | struct rsp_que **rsp) | ||
850 | { | 850 | { |
851 | struct scsi_cmnd *cmd = sp->cmd; | 851 | struct scsi_cmnd *cmd = sp->cmd; |
852 | struct scsi_qla_host *vha = sp->fcport->vha; | ||
853 | struct qla_hw_data *ha = sp->fcport->vha->hw; | 852 | struct qla_hw_data *ha = sp->fcport->vha->hw; |
854 | int affinity = cmd->request->cpu; | 853 | int affinity = cmd->request->cpu; |
855 | 854 | ||
856 | if (ql2xmultique_tag && affinity >= 0 && | 855 | if (ql2xmultique_tag && affinity >= 0 && |
857 | affinity < ha->max_rsp_queues - 1) { | 856 | affinity < ha->max_rsp_queues - 1) |
858 | *rsp = ha->rsp_q_map[affinity + 1]; | 857 | *rsp = ha->rsp_q_map[affinity + 1]; |
859 | *req = ha->req_q_map[1]; | 858 | else |
860 | } else { | ||
861 | *req = vha->req; | ||
862 | *rsp = ha->rsp_q_map[0]; | 859 | *rsp = ha->rsp_q_map[0]; |
863 | } | ||
864 | } | 860 | } |