diff options
author | Vijaya Mohan Guvva <vmohan@brocade.com> | 2013-11-21 04:37:49 -0500 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2013-12-03 09:56:49 -0500 |
commit | 22a08538dca5c0630226f1c0c58dccd12e463d22 (patch) | |
tree | 236bf0a60c617996b46abb615045d71d01a4328a | |
parent | a1470c7bf3a4676e62e4c0fb204e339399eb5c59 (diff) |
[SCSI] bfa: Fix crash when symb name set for offline vport
This patch fixes a crash when tried setting symbolic name for an offline
vport through sysfs. Crash is due to uninitialized pointer lport->ns,
which gets initialized only on linkup (port online).
Signed-off-by: Vijaya Mohan Guvva <vmohan@brocade.com>
Cc: stable@vger.kernel.org
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
-rw-r--r-- | drivers/scsi/bfa/bfa_fcs.h | 1 | ||||
-rw-r--r-- | drivers/scsi/bfa/bfa_fcs_lport.c | 14 | ||||
-rw-r--r-- | drivers/scsi/bfa/bfad_attr.c | 7 |
3 files changed, 14 insertions, 8 deletions
diff --git a/drivers/scsi/bfa/bfa_fcs.h b/drivers/scsi/bfa/bfa_fcs.h index 94d5d0102f7d..42bcb970445a 100644 --- a/drivers/scsi/bfa/bfa_fcs.h +++ b/drivers/scsi/bfa/bfa_fcs.h | |||
@@ -296,6 +296,7 @@ wwn_t bfa_fcs_lport_get_rport(struct bfa_fcs_lport_s *port, wwn_t wwn, | |||
296 | struct bfa_fcs_lport_s *bfa_fcs_lookup_port(struct bfa_fcs_s *fcs, | 296 | struct bfa_fcs_lport_s *bfa_fcs_lookup_port(struct bfa_fcs_s *fcs, |
297 | u16 vf_id, wwn_t lpwwn); | 297 | u16 vf_id, wwn_t lpwwn); |
298 | 298 | ||
299 | void bfa_fcs_lport_set_symname(struct bfa_fcs_lport_s *port, char *symname); | ||
299 | void bfa_fcs_lport_get_info(struct bfa_fcs_lport_s *port, | 300 | void bfa_fcs_lport_get_info(struct bfa_fcs_lport_s *port, |
300 | struct bfa_lport_info_s *port_info); | 301 | struct bfa_lport_info_s *port_info); |
301 | void bfa_fcs_lport_get_attr(struct bfa_fcs_lport_s *port, | 302 | void bfa_fcs_lport_get_attr(struct bfa_fcs_lport_s *port, |
diff --git a/drivers/scsi/bfa/bfa_fcs_lport.c b/drivers/scsi/bfa/bfa_fcs_lport.c index 2f61a5af3658..f5e4e61a0fd7 100644 --- a/drivers/scsi/bfa/bfa_fcs_lport.c +++ b/drivers/scsi/bfa/bfa_fcs_lport.c | |||
@@ -1097,6 +1097,17 @@ bfa_fcs_lport_init(struct bfa_fcs_lport_s *lport, | |||
1097 | bfa_sm_send_event(lport, BFA_FCS_PORT_SM_CREATE); | 1097 | bfa_sm_send_event(lport, BFA_FCS_PORT_SM_CREATE); |
1098 | } | 1098 | } |
1099 | 1099 | ||
1100 | void | ||
1101 | bfa_fcs_lport_set_symname(struct bfa_fcs_lport_s *port, | ||
1102 | char *symname) | ||
1103 | { | ||
1104 | strcpy(port->port_cfg.sym_name.symname, symname); | ||
1105 | |||
1106 | if (bfa_sm_cmp_state(port, bfa_fcs_lport_sm_online)) | ||
1107 | bfa_fcs_lport_ns_util_send_rspn_id( | ||
1108 | BFA_FCS_GET_NS_FROM_PORT(port), NULL); | ||
1109 | } | ||
1110 | |||
1100 | /* | 1111 | /* |
1101 | * fcs_lport_api | 1112 | * fcs_lport_api |
1102 | */ | 1113 | */ |
@@ -5140,9 +5151,6 @@ bfa_fcs_lport_ns_util_send_rspn_id(void *cbarg, struct bfa_fcxp_s *fcxp_alloced) | |||
5140 | u8 *psymbl = &symbl[0]; | 5151 | u8 *psymbl = &symbl[0]; |
5141 | int len; | 5152 | int len; |
5142 | 5153 | ||
5143 | if (!bfa_sm_cmp_state(port, bfa_fcs_lport_sm_online)) | ||
5144 | return; | ||
5145 | |||
5146 | /* Avoid sending RSPN in the following states. */ | 5154 | /* Avoid sending RSPN in the following states. */ |
5147 | if (bfa_sm_cmp_state(ns, bfa_fcs_lport_ns_sm_offline) || | 5155 | if (bfa_sm_cmp_state(ns, bfa_fcs_lport_ns_sm_offline) || |
5148 | bfa_sm_cmp_state(ns, bfa_fcs_lport_ns_sm_plogi_sending) || | 5156 | bfa_sm_cmp_state(ns, bfa_fcs_lport_ns_sm_plogi_sending) || |
diff --git a/drivers/scsi/bfa/bfad_attr.c b/drivers/scsi/bfa/bfad_attr.c index e9a681d31223..40be670a1cbc 100644 --- a/drivers/scsi/bfa/bfad_attr.c +++ b/drivers/scsi/bfa/bfad_attr.c | |||
@@ -593,11 +593,8 @@ bfad_im_vport_set_symbolic_name(struct fc_vport *fc_vport) | |||
593 | return; | 593 | return; |
594 | 594 | ||
595 | spin_lock_irqsave(&bfad->bfad_lock, flags); | 595 | spin_lock_irqsave(&bfad->bfad_lock, flags); |
596 | if (strlen(sym_name) > 0) { | 596 | if (strlen(sym_name) > 0) |
597 | strcpy(fcs_vport->lport.port_cfg.sym_name.symname, sym_name); | 597 | bfa_fcs_lport_set_symname(&fcs_vport->lport, sym_name); |
598 | bfa_fcs_lport_ns_util_send_rspn_id( | ||
599 | BFA_FCS_GET_NS_FROM_PORT((&fcs_vport->lport)), NULL); | ||
600 | } | ||
601 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); | 598 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); |
602 | } | 599 | } |
603 | 600 | ||