All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christof Schmitt <christof.schmitt@de.ibm.com>
To: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: linux-scsi@vger.kernel.org, linux-s390@vger.kernel.org,
	schwidefsky@de.ibm.com, heiko.carstens@de.ibm.com,
	Christof Schmitt <christof.schmitt@de.ibm.com>
Subject: [patch 03/15] zfcp: Dont call zfcp_fsf_req_free on NULL pointer
Date: Fri, 17 Apr 2009 15:08:03 +0200	[thread overview]
Message-ID: <20090417131122.219876000@de.ibm.com> (raw)
In-Reply-To: 20090417130800.923944000@de.ibm.com

[-- Attachment #1: 702-zfcp-fsf-req-free.diff --]
[-- Type: text/plain, Size: 2293 bytes --]

From: Christof Schmitt <christof.schmitt@de.ibm.com>

Fix problem that zfcp_fsf_exchange_config_data_sync and
zfcp_fsf_exchange_config_data_sync could try to call zfcp_fsf_req_free
with a NULL pointer.

Reviewed-by: Martin Petermann <martin@linux.vnet.ibm.com>
Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
---

 drivers/s390/scsi/zfcp_fsf.c |   18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

--- a/drivers/s390/scsi/zfcp_fsf.c	2009-04-17 15:03:25.000000000 +0200
+++ b/drivers/s390/scsi/zfcp_fsf.c	2009-04-17 15:03:33.000000000 +0200
@@ -1254,13 +1254,13 @@ int zfcp_fsf_exchange_config_data_sync(s
 
 	spin_lock_bh(&adapter->req_q_lock);
 	if (zfcp_fsf_req_sbal_get(adapter))
-		goto out;
+		goto out_unlock;
 
 	req = zfcp_fsf_req_create(adapter, FSF_QTCB_EXCHANGE_CONFIG_DATA,
 				  0, NULL);
 	if (IS_ERR(req)) {
 		retval = PTR_ERR(req);
-		goto out;
+		goto out_unlock;
 	}
 
 	sbale = zfcp_qdio_sbale_req(req);
@@ -1279,14 +1279,16 @@ int zfcp_fsf_exchange_config_data_sync(s
 
 	zfcp_fsf_start_timer(req, ZFCP_FSF_REQUEST_TIMEOUT);
 	retval = zfcp_fsf_req_send(req);
-out:
 	spin_unlock_bh(&adapter->req_q_lock);
 	if (!retval)
 		wait_event(req->completion_wq,
 			   req->status & ZFCP_STATUS_FSFREQ_COMPLETED);
 
 	zfcp_fsf_req_free(req);
+	return retval;
 
+out_unlock:
+	spin_unlock_bh(&adapter->req_q_lock);
 	return retval;
 }
 
@@ -1353,13 +1355,13 @@ int zfcp_fsf_exchange_port_data_sync(str
 
 	spin_lock_bh(&adapter->req_q_lock);
 	if (zfcp_fsf_req_sbal_get(adapter))
-		goto out;
+		goto out_unlock;
 
 	req = zfcp_fsf_req_create(adapter, FSF_QTCB_EXCHANGE_PORT_DATA, 0,
 				  NULL);
 	if (IS_ERR(req)) {
 		retval = PTR_ERR(req);
-		goto out;
+		goto out_unlock;
 	}
 
 	if (data)
@@ -1372,14 +1374,18 @@ int zfcp_fsf_exchange_port_data_sync(str
 	req->handler = zfcp_fsf_exchange_port_data_handler;
 	zfcp_fsf_start_timer(req, ZFCP_FSF_REQUEST_TIMEOUT);
 	retval = zfcp_fsf_req_send(req);
-out:
 	spin_unlock_bh(&adapter->req_q_lock);
+
 	if (!retval)
 		wait_event(req->completion_wq,
 			   req->status & ZFCP_STATUS_FSFREQ_COMPLETED);
 	zfcp_fsf_req_free(req);
 
 	return retval;
+
+out_unlock:
+	spin_unlock_bh(&adapter->req_q_lock);
+	return retval;
 }
 
 static void zfcp_fsf_open_port_handler(struct zfcp_fsf_req *req)

  parent reply	other threads:[~2009-04-17 13:08 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-17 13:08 [patch 00/15] zfcp fixes for 2.6.30-rc2 Christof Schmitt
2009-04-17 13:08 ` [patch 01/15] zfcp: Avoid referencing freed memory in req send Christof Schmitt
2009-04-17 13:08 ` [patch 02/15] zfcp: Enable auto-port discovery for NPIV Christof Schmitt
2009-04-17 13:08 ` Christof Schmitt [this message]
2009-04-17 13:08 ` [patch 04/15] zfcp: Dont block zfcp_wq with scan Christof Schmitt
2009-04-17 13:08 ` [patch 05/15] zfcp: Set WKA-port to offline on adapter deactivation Christof Schmitt
2009-04-17 13:08 ` [patch 06/15] zfcp: avoid false ERP complete due to sema race Christof Schmitt
2009-04-17 13:08 ` [patch 07/15] zfcp: no port recovery after storage side error inject Christof Schmitt
2009-04-17 13:08 ` [patch 08/15] zfcp: remove unit will fail if add unit is not finished Christof Schmitt
2009-04-17 13:08 ` [patch 09/15] zfcp: Let actcli handle control file errors Christof Schmitt
2009-04-17 13:08 ` [patch 10/15] zfcp: no port recovery after ADISC request timeout Christof Schmitt
2009-04-17 13:08 ` [patch 11/15] zfcp: Fix abort handler for completions in progress Christof Schmitt
2009-04-17 13:08 ` [patch 12/15] zfcp: revert previous patch for sbal counting Christof Schmitt
2009-04-17 13:08 ` [patch 13/15] zfcp: Fix port reference counting Christof Schmitt
2009-04-17 13:08 ` [patch 14/15] zfcp: Reference counting for cfdc requests Christof Schmitt
2009-04-17 13:08 ` [patch 15/15] zfcp: Fix oops when port disappears Christof Schmitt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090417131122.219876000@de.ibm.com \
    --to=christof.schmitt@de.ibm.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=heiko.carstens@de.ibm.com \
    --cc=linux-s390@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=schwidefsky@de.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.