linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steffen Maier <maier@linux.vnet.ibm.com>
To: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: linux-scsi@vger.kernel.org, linux-s390@vger.kernel.org,
	Martin Schwidefsky <schwidefsky@de.ibm.com>,
	Heiko Carstens <heiko.carstens@de.ibm.com>,
	Steffen Maier <maier@linux.vnet.ibm.com>,
	Julia Lawall <Julia.Lawall@lip6.fr>,
	stable@vger.kernel.org
Subject: [PATCH 5/8] zfcp: remove invalid reference to list iterator variable
Date: Tue, 04 Sep 2012 15:23:33 +0200	[thread overview]
Message-ID: <20120904132348.738575595@linux.vnet.ibm.com> (raw)
In-Reply-To: 20120904132328.564402930@linux.vnet.ibm.com

[-- Attachment #1: 709-zfcp-remove-invalid-reference-to-list-iterator-variable.patch --]
[-- Type: text/plain, Size: 1348 bytes --]

From: Julia Lawall <Julia.Lawall@lip6.fr>

If list_for_each_entry, etc complete a traversal of the list, the iterator
variable ends up pointing to an address at an offset from the list head,
and not a meaningful structure.  Thus this value should not be used after
the end of the iterator.  Replace port->adapter->scsi_host by
adapter->scsi_host.

This problem was found using Coccinelle (http://coccinelle.lip6.fr/).

Oversight in upsteam commit of v2.6.37
a1ca48319a9aa1c5b57ce142f538e76050bb8972
"[SCSI] zfcp: Move ACL/CFDC code to zfcp_cfdc.c"
which merged the content of zfcp_erp_port_access_changed().

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Steffen Maier <maier@linux.vnet.ibm.com>
Reviewed-by: Martin Peschke <mpeschke@linux.vnet.ibm.com>
Cc: <stable@vger.kernel.org> #2.6.37+
---
 drivers/s390/scsi/zfcp_cfdc.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/s390/scsi/zfcp_cfdc.c
+++ b/drivers/s390/scsi/zfcp_cfdc.c
@@ -293,7 +293,7 @@ void zfcp_cfdc_adapter_access_changed(st
 	}
 	read_unlock_irqrestore(&adapter->port_list_lock, flags);
 
-	shost_for_each_device(sdev, port->adapter->scsi_host) {
+	shost_for_each_device(sdev, adapter->scsi_host) {
 		zfcp_sdev = sdev_to_zfcp(sdev);
 		status = atomic_read(&zfcp_sdev->status);
 		if ((status & ZFCP_STATUS_COMMON_ACCESS_DENIED) ||


  parent reply	other threads:[~2012-09-04 13:29 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-04 13:23 [PATCH 0/8] zfcp: patches for 3.6-rc Steffen Maier
2012-09-04 13:23 ` [PATCH 1/8] zfcp: Adapt to new FC_PORTSPEED semantics Steffen Maier
2012-09-04 13:23 ` [PATCH 2/8] zfcp: Make trace record tags unique Steffen Maier
2012-09-04 13:23 ` [PATCH 3/8] zfcp: Bounds checking for deferred error trace Steffen Maier
2012-09-04 13:23 ` [PATCH 4/8] zfcp: Do not wakeup while suspended Steffen Maier
2012-09-04 13:23 ` Steffen Maier [this message]
2012-09-04 13:23 ` [PATCH 6/8] zfcp: restore refcount check on port_remove Steffen Maier
2012-09-04 13:23 ` [PATCH 7/8] zfcp: No automatic port_rescan on events Steffen Maier
2012-09-04 13:23 ` [PATCH 8/8] zfcp: only access zfcp_scsi_dev for valid scsi_device Steffen Maier

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=20120904132348.738575595@linux.vnet.ibm.com \
    --to=maier@linux.vnet.ibm.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=Julia.Lawall@lip6.fr \
    --cc=heiko.carstens@de.ibm.com \
    --cc=linux-s390@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=schwidefsky@de.ibm.com \
    --cc=stable@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).