Message ID | 1452213645-18889-1-git-send-email-kys@microsoft.com (mailing list archive) |
---|---|
State | Not Applicable, archived |
Headers | show |
On Thu, 2016-01-07 at 16:40 -0800, K. Y. Srinivasan wrote: > The macro startget_to_rport() can return NULL; handle that case > properly. OK, can we unwind why you think you could possibly need this? It would mean that fc_timed_out was called for a non-FC device, which was thought to be an impossibility when the fc transport class was designed. James > Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> > Cc: <stable@vger.kernel.org> > --- > drivers/scsi/scsi_transport_fc.c | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/drivers/scsi/scsi_transport_fc.c > b/drivers/scsi/scsi_transport_fc.c > index 24eaaf6..42a908f 100644 > --- a/drivers/scsi/scsi_transport_fc.c > +++ b/drivers/scsi/scsi_transport_fc.c > @@ -2081,7 +2081,7 @@ fc_timed_out(struct scsi_cmnd *scmd) > { > struct fc_rport *rport = starget_to_rport(scsi_target(scmd > ->device)); > > - if (rport->port_state == FC_PORTSTATE_BLOCKED) > + if ((rport == NULL) || (rport->port_state == > FC_PORTSTATE_BLOCKED)) > return BLK_EH_RESET_TIMER; > > return BLK_EH_NOT_HANDLED; -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
DQoNCj4gLS0tLS1PcmlnaW5hbCBNZXNzYWdlLS0tLS0NCj4gRnJvbTogSmFtZXMgQm90dG9tbGV5 IFttYWlsdG86SmFtZXMuQm90dG9tbGV5QEhhbnNlblBhcnRuZXJzaGlwLmNvbV0NCj4gU2VudDog VGh1cnNkYXksIEphbnVhcnkgNywgMjAxNiAzOjQ5IFBNDQo+IFRvOiBLWSBTcmluaXZhc2FuIDxr eXNAbWljcm9zb2Z0LmNvbT47IGdyZWdraEBsaW51eGZvdW5kYXRpb24ub3JnOyBsaW51eC0NCj4g a2VybmVsQHZnZXIua2VybmVsLm9yZzsgZGV2ZWxAbGludXhkcml2ZXJwcm9q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UU1RBVEVfQkxPQ0tFRCkpDQo+ID4gIAkJcmV0dXJuIEJMS19FSF9SRVNFVF9U SU1FUjsNCj4gPg0KPiA+ICAJcmV0dXJuIEJMS19FSF9OT1RfSEFORExFRDsNCg0K -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c index 24eaaf6..42a908f 100644 --- a/drivers/scsi/scsi_transport_fc.c +++ b/drivers/scsi/scsi_transport_fc.c @@ -2081,7 +2081,7 @@ fc_timed_out(struct scsi_cmnd *scmd) { struct fc_rport *rport = starget_to_rport(scsi_target(scmd->device)); - if (rport->port_state == FC_PORTSTATE_BLOCKED) + if ((rport == NULL) || (rport->port_state == FC_PORTSTATE_BLOCKED)) return BLK_EH_RESET_TIMER; return BLK_EH_NOT_HANDLED;
The macro startget_to_rport() can return NULL; handle that case properly. Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Cc: <stable@vger.kernel.org> --- drivers/scsi/scsi_transport_fc.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)