public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Christof Schmitt <christof.schmitt@de.ibm.com>
To: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: linux-scsi@vger.kernel.org,
	Sven Schuetz <sven@linux.vnet.ibm.com>,
	James.Smart@Emulex.Com
Subject: Re: [patch 2/2] zfcp: Add FC pass-through support
Date: Wed, 8 Apr 2009 13:38:48 +0200	[thread overview]
Message-ID: <20090408113847.GA12089@schmichrtp.de.ibm.com> (raw)
In-Reply-To: <20090408132945.6c847b74@osiris.boeblingen.de.ibm.com>

On Wed, Apr 08, 2009 at 01:29:45PM +0200, Heiko Carstens wrote:
> On Mon, 06 Apr 2009 18:31:47 +0200
> Christof Schmitt <christof.schmitt@de.ibm.com> wrote:
> > +	els_fc_job->els.adapter = adapter;
> > +	if (rport) {
> > +		read_lock_irq(&zfcp_data.config_lock);
> > +		port = rport->dd_data;
> > +		if (port)
> > +			zfcp_port_get(port);
> > +		read_unlock_irq(&zfcp_data.config_lock);
> > +		if (!port) {
> > +			kfree(els_fc_job);
> > +			return -EINVAL;
> > +		}
> > +		els_fc_job->els.port = port;
> > +		els_fc_job->els.d_id = port->d_id;
> > +		zfcp_port_put(port);
> > +	} else {
> 
> This piece looks a bit strange. Why is the reference count of the port
> increased and afterwards decreased again? Still the pointer to the port
> gets added to els_fc_job->els.port and therefore the structure will be
> accessed later.
> 
> So either the reference count is decreased too early and this is a bug
> or it's not needed at all.

Only the d_id is needed from the port, after this we don't access the
port anymore. The assignment of the pointer to els.port is not
required. We might do without the reference count and try to get the
d_id while holding the config_lock.

Christof

      reply	other threads:[~2009-04-08 11:39 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-06 16:31 [patch 0/2] FC pass-through support for zfcp Christof Schmitt
2009-04-06 16:31 ` [patch 1/2] zfcp: Set WKA-port to offline on adapter deactivation Christof Schmitt
2009-04-06 16:31 ` [patch 2/2] zfcp: Add FC pass-through support Christof Schmitt
2009-04-07 23:17   ` James Smart
2009-04-08  7:39     ` Christof Schmitt
2009-04-08 11:29   ` Heiko Carstens
2009-04-08 11:38     ` Christof Schmitt [this message]

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=20090408113847.GA12089@schmichrtp.de.ibm.com \
    --to=christof.schmitt@de.ibm.com \
    --cc=James.Smart@Emulex.Com \
    --cc=heiko.carstens@de.ibm.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=sven@linux.vnet.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox