[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>
This commit is contained in:
Родитель
a1470c7bf3
Коммит
22a08538dc
|
@ -296,6 +296,7 @@ wwn_t bfa_fcs_lport_get_rport(struct bfa_fcs_lport_s *port, wwn_t wwn,
|
|||
struct bfa_fcs_lport_s *bfa_fcs_lookup_port(struct bfa_fcs_s *fcs,
|
||||
u16 vf_id, wwn_t lpwwn);
|
||||
|
||||
void bfa_fcs_lport_set_symname(struct bfa_fcs_lport_s *port, char *symname);
|
||||
void bfa_fcs_lport_get_info(struct bfa_fcs_lport_s *port,
|
||||
struct bfa_lport_info_s *port_info);
|
||||
void bfa_fcs_lport_get_attr(struct bfa_fcs_lport_s *port,
|
||||
|
|
|
@ -1097,6 +1097,17 @@ bfa_fcs_lport_init(struct bfa_fcs_lport_s *lport,
|
|||
bfa_sm_send_event(lport, BFA_FCS_PORT_SM_CREATE);
|
||||
}
|
||||
|
||||
void
|
||||
bfa_fcs_lport_set_symname(struct bfa_fcs_lport_s *port,
|
||||
char *symname)
|
||||
{
|
||||
strcpy(port->port_cfg.sym_name.symname, symname);
|
||||
|
||||
if (bfa_sm_cmp_state(port, bfa_fcs_lport_sm_online))
|
||||
bfa_fcs_lport_ns_util_send_rspn_id(
|
||||
BFA_FCS_GET_NS_FROM_PORT(port), NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* fcs_lport_api
|
||||
*/
|
||||
|
@ -5140,9 +5151,6 @@ bfa_fcs_lport_ns_util_send_rspn_id(void *cbarg, struct bfa_fcxp_s *fcxp_alloced)
|
|||
u8 *psymbl = &symbl[0];
|
||||
int len;
|
||||
|
||||
if (!bfa_sm_cmp_state(port, bfa_fcs_lport_sm_online))
|
||||
return;
|
||||
|
||||
/* Avoid sending RSPN in the following states. */
|
||||
if (bfa_sm_cmp_state(ns, bfa_fcs_lport_ns_sm_offline) ||
|
||||
bfa_sm_cmp_state(ns, bfa_fcs_lport_ns_sm_plogi_sending) ||
|
||||
|
|
|
@ -593,11 +593,8 @@ bfad_im_vport_set_symbolic_name(struct fc_vport *fc_vport)
|
|||
return;
|
||||
|
||||
spin_lock_irqsave(&bfad->bfad_lock, flags);
|
||||
if (strlen(sym_name) > 0) {
|
||||
strcpy(fcs_vport->lport.port_cfg.sym_name.symname, sym_name);
|
||||
bfa_fcs_lport_ns_util_send_rspn_id(
|
||||
BFA_FCS_GET_NS_FROM_PORT((&fcs_vport->lport)), NULL);
|
||||
}
|
||||
if (strlen(sym_name) > 0)
|
||||
bfa_fcs_lport_set_symname(&fcs_vport->lport, sym_name);
|
||||
spin_unlock_irqrestore(&bfad->bfad_lock, flags);
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче