[SCSI] libfc: fix referencing to fc_fcp_pkt from the frame pointer via fr_fsp()
In commit 6a716a8
, while releasing the DDP context in case frame_send() failed,
the frame may already be freed, so we should store the pointer to fc_fcp_pkt and
release the DDP context using the locally stored fsp instead of getting fsp from
the fr_fsp(fp) on a frame.
Signed-off-by: Yi Zou <yi.zou@intel.com>
Reported-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
Tested-by: Ross Brattain <ross.b.brattain@intel.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
This commit is contained in:
parent
21cc0bd3a9
commit
3ee17f59c5
|
@ -1981,6 +1981,7 @@ static struct fc_seq *fc_exch_seq_send(struct fc_lport *lport,
|
||||||
struct fc_exch *ep;
|
struct fc_exch *ep;
|
||||||
struct fc_seq *sp = NULL;
|
struct fc_seq *sp = NULL;
|
||||||
struct fc_frame_header *fh;
|
struct fc_frame_header *fh;
|
||||||
|
struct fc_fcp_pkt *fsp = NULL;
|
||||||
int rc = 1;
|
int rc = 1;
|
||||||
|
|
||||||
ep = fc_exch_alloc(lport, fp);
|
ep = fc_exch_alloc(lport, fp);
|
||||||
|
@ -2003,8 +2004,10 @@ static struct fc_seq *fc_exch_seq_send(struct fc_lport *lport,
|
||||||
fc_exch_setup_hdr(ep, fp, ep->f_ctl);
|
fc_exch_setup_hdr(ep, fp, ep->f_ctl);
|
||||||
sp->cnt++;
|
sp->cnt++;
|
||||||
|
|
||||||
if (ep->xid <= lport->lro_xid && fh->fh_r_ctl == FC_RCTL_DD_UNSOL_CMD)
|
if (ep->xid <= lport->lro_xid && fh->fh_r_ctl == FC_RCTL_DD_UNSOL_CMD) {
|
||||||
|
fsp = fr_fsp(fp);
|
||||||
fc_fcp_ddp_setup(fr_fsp(fp), ep->xid);
|
fc_fcp_ddp_setup(fr_fsp(fp), ep->xid);
|
||||||
|
}
|
||||||
|
|
||||||
if (unlikely(lport->tt.frame_send(lport, fp)))
|
if (unlikely(lport->tt.frame_send(lport, fp)))
|
||||||
goto err;
|
goto err;
|
||||||
|
@ -2018,7 +2021,8 @@ static struct fc_seq *fc_exch_seq_send(struct fc_lport *lport,
|
||||||
spin_unlock_bh(&ep->ex_lock);
|
spin_unlock_bh(&ep->ex_lock);
|
||||||
return sp;
|
return sp;
|
||||||
err:
|
err:
|
||||||
fc_fcp_ddp_done(fr_fsp(fp));
|
if (fsp)
|
||||||
|
fc_fcp_ddp_done(fsp);
|
||||||
rc = fc_exch_done_locked(ep);
|
rc = fc_exch_done_locked(ep);
|
||||||
spin_unlock_bh(&ep->ex_lock);
|
spin_unlock_bh(&ep->ex_lock);
|
||||||
if (!rc)
|
if (!rc)
|
||||||
|
|
Loading…
Reference in New Issue