mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Brent Casavant <bcasavan@sgi.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: linux-kernel@vger.kernel.org, Andrew Morton <akpm@osdl.org>
Subject: Re: [PATCH 2/2] external interrupts: IOC4 driver
Date: Tue, 23 Aug 2005 17:17:45 -0500 (CDT)	[thread overview]
Message-ID: <20050823170346.D7236@chenjesu.americas.sgi.com> (raw)
In-Reply-To: <20050820095209.GD21698@infradead.org>

On Sat, 20 Aug 2005, Christoph Hellwig wrote:

> > +config EXTINT_SGI_IOC4
> > +	tristate "Device driver for SGI IOC4 external interrupts"
> > +	depends on (IA64_GENERIC || IA64_SGI_SN2) && EXTINT && BLK_DEV_SGIIOC4
> 
> Is the ioc4 core abstraction config symbol really BLK_DEV_SGIIOC4?
> That probably wants fixing in a separate patch.

Oops.  Yes, in the past BLK_DEV_SGIIOC4 was the core abstraction config
symbol.  That was fixed a release or two ago, but obviously I've been
working on the external interrupt stuff for a while.  Fixed.

> > +	  This option enables support for the external interrupt ingest
> > +	  and generation capabilities of SGI IOC4 IO controllers.  If
> > +	  you have an SGI Altix with an IOC4 based IO card, say Y.
> > +	  Otherwise, say N.
> 
> Is there any Altix without an ioc4?

Yes, the Altix 330 uses third-party chips to provide base I/O functions.
Other future Altix products will similarly lack IOC4 (at least in their
base configuration).

> > +static ssize_t ioc4_extint_get_modelist(struct extint_device *ed, char *buf) {
> 
> opening brace on a separate line please.

Sorry.  Lindent took to mungeing my source (indenting in structure
definitions in particular) in unreadable ways, so I stopped using it.
Old coding styles die hard and all.

> > +#if PAGE_SIZE <= IOC4_A_INT_OUT_LENGTH
> > +	/* Only set up INT_OUT register alias page if the system page size
> > +	 * is equal to or less than the register alias page size.  Otherwise
> > +	 * the user would have access to registers other than INT_OUT.
> > +	 */
> > +	a_int_out = pci_resource_start(ied->idd->idd_pdev, 0) +
> > +	    IOC4_A_INT_OUT_OFFSET;
> > +	if (!a_int_out) {
> > +		printk(KERN_WARNING
> > +		       "%s: Unable to get IOC4 int_out alias mapping "
> > +		       "for pci_dev 0x%p.\n", __FUNCTION__, ied->idd->idd_pdev);
> > +		goto skip_alias;
> > +	}
> > +	if (!request_region(a_int_out, IOC4_A_INT_OUT_LENGTH,
> > +			    "ioc4_a_int_out")) {
> 
> This looks rather bad.  So the driver silently has less functionality
> when using a bigger page size?

For security correctness we cannot allow this page to be mapped by
anything larger than a 16K page, as that would allow the user access
to control registers which are not harmless if exposed.

However, the loss of functionality isn't silent.  In ioc4_extint_mmap()
we return -ENXIO if the mapping cannot be performed for the aforementioned
reason.  A well-written application will check for failures from mmap(2).

> > +static int ioc4_extint_remove(struct ioc4_driver_data *idd)
> > +{
> > +	struct extint_device *ed = idd->idd_extint_data;
> > +	struct ioc4_extint_device *ied;
> > +
> > +	/* If probe failed, avoid trying to remove */
> > +	if (ed)
> > +		ied = extint_get_devdata(ed);
> > +	else
> > +		return -ENXIO;
> 
> This should at lease be written:
> 
> 	if (!ed)
> 		return -ENXIO;
> 	ied = extint_get_devdata(ed);
> 
> but I don't understand how it can happen anyway.  ->remove shoould
> never be called unless ->probe initialized the device fully and
> returned 0

It was just one of many things where I coded defensively and intended
to revisit it later.  Unfortunately the revisit never took place.
Thanks for the catch -- fixed now.

Thanks,
Brent

-- 
Brent Casavant                          If you had nothing to fear,
bcasavan@sgi.com                        how then could you be brave?
Silicon Graphics, Inc.                    -- Queen Dama, Source Wars

  reply	other threads:[~2005-08-23 22:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-19 21:56 Brent Casavant
2005-08-20  9:52 ` Christoph Hellwig
2005-08-23 22:17   ` Brent Casavant [this message]
  -- strict thread matches above, loose matches on Subject: below --
2005-07-28 21:13 Brent Casavant

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=20050823170346.D7236@chenjesu.americas.sgi.com \
    --to=bcasavan@sgi.com \
    --cc=akpm@osdl.org \
    --cc=hch@infradead.org \
    --cc=linux-kernel@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

Powered by JetHome