public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Vasquez <andrew.vasquez@qlogic.com>
To: David Miller <davem@davemloft.net>
Cc: joy@entuzijast.net, sparclinux@vger.kernel.org,
	linux-scsi@vger.kernel.org
Subject: Re: kernel 2.6.26.3 qla2xxx oopsing on Fire 280R
Date: Mon, 8 Sep 2008 14:49:32 -0700	[thread overview]
Message-ID: <20080908214932.GF22598@plap4-2.qlogic.org> (raw)
In-Reply-To: <20080908.142351.00296600.davem@davemloft.net>

On Mon, 08 Sep 2008, David Miller wrote:

> From: Andrew Vasquez <andrew.vasquez@qlogic.com>
> Date: Mon, 8 Sep 2008 14:13:31 -0700
> 
> > That's odd, as fc_flush_work() is quite minimal:
> > 
> > 	static void
> > 	fc_flush_work(struct Scsi_Host *shost)
> > 	{
> > 		if (!fc_host_work_q(shost)) {
> > 			printk(KERN_ERR
> > 				"ERROR: FC host '%s' attempted to flush work, "
> > 				"when no workqueue created.\n", shost->hostt->name);
> > 			dump_stack();
> > 			return;
> > 		}
> > 
> > 		flush_workqueue(fc_host_work_q(shost));
> > 	}
> > 
> > there's not much chance here for a NULL-dereference.
> 
> There are several.
> 
> In this particular case, looking at the instruction dump, it appears
> to be shost->shost_data is NULL in this case, via the expansion of
> fc_host_work_q which is defined as:
> 
> #define fc_host_work_q(x) \
> 	(((struct fc_host_attrs *)(x)->shost_data)->work_q)

That would be be quite scary, since I would have expected
scsi_add_host() to kmalloc the required transport bits:

	int scsi_add_host(struct Scsi_Host *shost, struct device *dev)
	{
		struct scsi_host_template *sht = shost->hostt;
		int error = -EINVAL;

		...
		if (shost->transportt->host_size) {
			shost->shost_data = kzalloc(shost->transportt->host_size,
						 GFP_KERNEL);
			if (shost->shost_data == NULL) {
				error = -ENOMEM;
				goto out_del_dev;
			}
		}

well before a driver attempted to add an rport.  host_size is set indirectly
during qla2x00_module_init()'s call to fc_attach_transport():

	struct scsi_transport_template *
	fc_attach_transport(struct fc_function_template *ft)
	{
		...
		i->t.host_size = sizeof(struct fc_host_attrs);

Hmm...  Still looking...

  reply	other threads:[~2008-09-08 21:49 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-04  9:39 kernel 2.6.26.3 qla2xxx oopsing on Fire 280R Josip Rodin
2008-09-08 21:13 ` Andrew Vasquez
2008-09-08 21:23   ` David Miller
2008-09-08 21:49     ` Andrew Vasquez [this message]
2008-09-08 23:08       ` David Miller
2008-09-08 23:42         ` Josip Rodin
2008-09-09  1:35         ` Andrew Vasquez
2008-09-09  1:49           ` Josip Rodin
2008-09-09  1:53   ` Josip Rodin
2008-09-09  2:01     ` Andrew Vasquez
2008-09-09 14:39       ` Josip Rodin
2008-09-09 15:00         ` Josip Rodin
2008-09-09 21:30           ` David Miller
2008-09-09 22:00             ` Josip Rodin
2008-09-09 22:57               ` David Miller
2008-09-09 22:59                 ` David Miller
2008-09-10  0:05                   ` Josip Rodin
2008-09-10  0:30                     ` David Miller
2008-09-11 11:37         ` Josip Rodin
2008-09-11 21:57           ` Josip Rodin
2008-09-11 22:01             ` David Miller
2008-09-11 22:15               ` Andrew Vasquez
2008-09-12  5:19                 ` [PATCH scsi-rc-fixes] qla2xxx: Defer enablement of RISC interrupts until ISP initialization completes Andrew Vasquez

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=20080908214932.GF22598@plap4-2.qlogic.org \
    --to=andrew.vasquez@qlogic.com \
    --cc=davem@davemloft.net \
    --cc=joy@entuzijast.net \
    --cc=linux-scsi@vger.kernel.org \
    --cc=sparclinux@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