Skip to content

Commit

Permalink
[SCSI] bfa: Fix possible NULL pointer dereference in lunmask add/delete.
Browse files Browse the repository at this point in the history
Patch fixes the possible NULL pointer dereference when we try to add or delete
a rpwwn to the lunmask config which is not zoned to this port.  Check if the
FCS rport is not NULL before de-referencing it.

Signed-off-by: Krishna Gudipati <kgudipat@brocade.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
  • Loading branch information
Krishna Gudipati authored and James Bottomley committed Jan 10, 2012
1 parent f163301 commit 6bc6204
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/scsi/bfa/bfa_fcpim.c
Original file line number Diff line number Diff line change
Expand Up @@ -2647,7 +2647,8 @@ bfa_fcpim_lunmask_add(struct bfa_s *bfa, u16 vf_id, wwn_t *pwwn,
if (port) {
*pwwn = port->port_cfg.pwwn;
rp_fcs = bfa_fcs_lport_get_rport_by_pwwn(port, rpwwn);
rp = rp_fcs->bfa_rport;
if (rp_fcs)
rp = rp_fcs->bfa_rport;
}

lunm_list = bfa_get_lun_mask_list(bfa);
Expand Down Expand Up @@ -2715,7 +2716,8 @@ bfa_fcpim_lunmask_delete(struct bfa_s *bfa, u16 vf_id, wwn_t *pwwn,
if (port) {
*pwwn = port->port_cfg.pwwn;
rp_fcs = bfa_fcs_lport_get_rport_by_pwwn(port, rpwwn);
rp = rp_fcs->bfa_rport;
if (rp_fcs)
rp = rp_fcs->bfa_rport;
}
}

Expand Down

0 comments on commit 6bc6204

Please sign in to comment.