From: Hugh Daschbach Date: Tue, 16 Feb 2010 20:15:28 +0000 (-0800) Subject: [SCSI] libfc: Don't assume response request present. X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=696c1cff5254bb3ac280fbbb639c66e9ff20306e;p=mv-sheeva.git [SCSI] libfc: Don't assume response request present. Fix NULL pointer dereference crash occurs in fc_lport_bsg_request() for bsg requests that do not contain a response request. Specifically, FC_BSG_HST_ADD_RPORT and FC_BSG_HST_DEL_RPORT bsg requests are not guaranteed to include a response request. Signed-off-by: Hugh Daschbach Signed-off-by: Robert Love Signed-off-by: James Bottomley --- diff --git a/drivers/scsi/libfc/fc_lport.c b/drivers/scsi/libfc/fc_lport.c index 0b165024a21..7ec8ce75007 100644 --- a/drivers/scsi/libfc/fc_lport.c +++ b/drivers/scsi/libfc/fc_lport.c @@ -1800,7 +1800,8 @@ int fc_lport_bsg_request(struct fc_bsg_job *job) u32 did; job->reply->reply_payload_rcv_len = 0; - rsp->resid_len = job->reply_payload.payload_len; + if (rsp) + rsp->resid_len = job->reply_payload.payload_len; mutex_lock(&lport->lp_mutex);