LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Michael Ellerman <michael@ellerman.id.au>
To: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: linux-pci@atrey.karlin.mff.cuni.cz,
	Greg Kroah-Hartman <greg@kroah.com>,
	"David S. Miller" <davem@davemloft.net>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	linux-kernel@vger.kernel.org, Andrew Morton <akpm@osdl.org>,
	daniel.e.wolstenholme@intel.com
Subject: Re: [PATCH 17/21] MSI: Clear the irq_desc's msi pointer on free
Date: Mon, 26 Mar 2007 12:57:16 +1000	[thread overview]
Message-ID: <1174877836.4782.6.camel@concordia.ozlabs.ibm.com> (raw)
In-Reply-To: <m1y7lo64v4.fsf@ebiederm.dsl.xmission.com>

[-- Attachment #1: Type: text/plain, Size: 1801 bytes --]

On Thu, 2007-03-22 at 21:00 -0600, Eric W. Biederman wrote:
> Michael Ellerman <michael@ellerman.id.au> writes:
> 
> > On Thu, 2007-03-22 at 08:23 -0600, Eric W. Biederman wrote:
> >> Michael Ellerman <michael@ellerman.id.au> writes:
> >> 
> >> > Currently we never clear the msi_desc pointer in the irq_desc. This
> >> > leaves us with a pointer to free'ed memory hanging around. No one seems
> >> > to have hit this, so presumably other parts of the code are protecting
> >> > us from ever using the stale pointer .. or we're just lucky, we should
> >> > still clear it.
> >> 
> >> Hmm.  Maybe.  Currently this is done in dynamic_irq_cleanup,
> >> at least for everything except sparc64.
> >
> > OK, I missed that. I still think we should do it here, otherwise there's
> > a window, however small, where the msi_desc pointer is pointing at freed
> > memory.
> 
> After following the code through the current cleanup happens before you are
> proposing, and in fact the irq is return to the set of irq's that can
> be allocated before you are calling set_irq_msi(irq, NULL).

We don't call dynamic_irq_cleanup(), so it never gets done. Perhaps we
should be using your dynamic_irq_init/cleanup.

> Therefore you are doing this too late and we need to ensure the
> architecture code does this in arch_teardown_msi_irq.

As long as the arch teardown routine somehow calls dynamic_irq_cleanup()
it should be fine. But I guess it's probably safer to just have all
archs do set_msi_irq(irq, NULL) in the teardown.

cheers

-- 
Michael Ellerman
OzLabs, IBM Australia Development Lab

wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)

We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

  reply	other threads:[~2007-03-26  2:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20070322105344.A34C6DDF74@ozlabs.org>
2007-03-22 14:23 ` Eric W. Biederman
2007-03-22 23:01   ` Michael Ellerman
2007-03-23  3:00     ` Eric W. Biederman
2007-03-26  2:57       ` Michael Ellerman [this message]
2007-03-26  3:07         ` Eric W. Biederman

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=1174877836.4782.6.camel@concordia.ozlabs.ibm.com \
    --to=michael@ellerman.id.au \
    --cc=akpm@osdl.org \
    --cc=benh@kernel.crashing.org \
    --cc=daniel.e.wolstenholme@intel.com \
    --cc=davem@davemloft.net \
    --cc=ebiederm@xmission.com \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@atrey.karlin.mff.cuni.cz \
    --subject='Re: [PATCH 17/21] MSI: Clear the irq_desc'\''s msi pointer on free' \
    /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

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).