Commit a17c5855 authored by Martin Petermann's avatar Martin Petermann Committed by James Bottomley

[SCSI] zfcp: Increase ref counter for port open requests

In rare cases, open port request might timeout, erp calls
zfcp_port_put, port gets dequeued. Now, the late returning (or
dismissed) fsf-port-open calls the fsf_port_open_handler that tries to
reference the port data structure leading to a kernel oops.
Signed-off-by: default avatarMartin Petermann <martin.petermann@de.ibm.com>
Signed-off-by: default avatarChristof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@HansenPartnership.com>
parent dceab655
...@@ -1402,7 +1402,7 @@ static void zfcp_fsf_open_port_handler(struct zfcp_fsf_req *req) ...@@ -1402,7 +1402,7 @@ static void zfcp_fsf_open_port_handler(struct zfcp_fsf_req *req)
struct fsf_plogi *plogi; struct fsf_plogi *plogi;
if (req->status & ZFCP_STATUS_FSFREQ_ERROR) if (req->status & ZFCP_STATUS_FSFREQ_ERROR)
return; goto out;
switch (header->fsf_status) { switch (header->fsf_status) {
case FSF_PORT_ALREADY_OPEN: case FSF_PORT_ALREADY_OPEN:
...@@ -1464,6 +1464,9 @@ static void zfcp_fsf_open_port_handler(struct zfcp_fsf_req *req) ...@@ -1464,6 +1464,9 @@ static void zfcp_fsf_open_port_handler(struct zfcp_fsf_req *req)
req->status |= ZFCP_STATUS_FSFREQ_ERROR; req->status |= ZFCP_STATUS_FSFREQ_ERROR;
break; break;
} }
out:
zfcp_port_put(port);
} }
/** /**
...@@ -1476,6 +1479,7 @@ int zfcp_fsf_open_port(struct zfcp_erp_action *erp_action) ...@@ -1476,6 +1479,7 @@ int zfcp_fsf_open_port(struct zfcp_erp_action *erp_action)
struct qdio_buffer_element *sbale; struct qdio_buffer_element *sbale;
struct zfcp_adapter *adapter = erp_action->adapter; struct zfcp_adapter *adapter = erp_action->adapter;
struct zfcp_fsf_req *req; struct zfcp_fsf_req *req;
struct zfcp_port *port = erp_action->port;
int retval = -EIO; int retval = -EIO;
spin_lock_bh(&adapter->req_q_lock); spin_lock_bh(&adapter->req_q_lock);
...@@ -1496,16 +1500,18 @@ int zfcp_fsf_open_port(struct zfcp_erp_action *erp_action) ...@@ -1496,16 +1500,18 @@ int zfcp_fsf_open_port(struct zfcp_erp_action *erp_action)
sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY; sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY;
req->handler = zfcp_fsf_open_port_handler; req->handler = zfcp_fsf_open_port_handler;
req->qtcb->bottom.support.d_id = erp_action->port->d_id; req->qtcb->bottom.support.d_id = port->d_id;
req->data = erp_action->port; req->data = port;
req->erp_action = erp_action; req->erp_action = erp_action;
erp_action->fsf_req = req; erp_action->fsf_req = req;
zfcp_port_get(port);
zfcp_fsf_start_erp_timer(req); zfcp_fsf_start_erp_timer(req);
retval = zfcp_fsf_req_send(req); retval = zfcp_fsf_req_send(req);
if (retval) { if (retval) {
zfcp_fsf_req_free(req); zfcp_fsf_req_free(req);
erp_action->fsf_req = NULL; erp_action->fsf_req = NULL;
zfcp_port_put(port);
} }
out: out:
spin_unlock_bh(&adapter->req_q_lock); spin_unlock_bh(&adapter->req_q_lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment