linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Michael Ellerman <patch-notifications@ellerman.id.au>
To: Radu Rendec <radu.rendec@gmail.com>, linuxppc-dev@lists.ozlabs.org
Cc: Radu Rendec <radu.rendec@gmail.com>, Paul Mackerras <paulus@samba.org>
Subject: Re: [1/1] Fix NULL pointer access in PowerPC MSI teardown code
Date: Sun,  2 Dec 2018 22:02:04 +1100 (AEDT)	[thread overview]
Message-ID: <4374vc6qfmz9sD4@ozlabs.org> (raw)
In-Reply-To: <20181128032048.11665-2-radu.rendec@gmail.com>

On Wed, 2018-11-28 at 03:20:48 UTC, Radu Rendec wrote:
> The arch_teardown_msi_irqs() function assumes that controller ops
> pointers were already checked in arch_setup_msi_irqs(), but this
> assumption is wrong: arch_teardown_msi_irqs() can be called even when
> arch_setup_msi_irqs() returns an error (-ENOSYS).
> 
> This can happen in the following scenario:
> 
>   * msi_capability_init() calls pci_msi_setup_msi_irqs()
>   * pci_msi_setup_msi_irqs() returns -ENOSYS
>   * msi_capability_init() notices the error and calls free_msi_irqs()
>   * free_msi_irqs() calls pci_msi_teardown_msi_irqs()
> 
> This is easier to see when CONFIG_PCI_MSI_IRQ_DOMAIN is not set and
> pci_msi_setup_msi_irqs() and pci_msi_teardown_msi_irqs() are just
> aliases to arch_setup_msi_irqs() and arch_teardown_msi_irqs().
> 
> The call to free_msi_irqs() upon pci_msi_setup_msi_irqs() failure seems
> legit, as it does additional cleanup; e.g. list_del(&entry->list) and
> kfree(entry) inside free_msi_irqs() do happen (MSI descriptors are
> allocated before pci_msi_setup_msi_irqs() is called and need to be
> cleaned up if that fails).
> 
> Signed-off-by: Radu Rendec <radu.rendec@gmail.com>

Applied to powerpc fixes, thanks.

https://git.kernel.org/powerpc/c/78e7b15e17ac175e7eed9e21c6f92d

cheers

  reply	other threads:[~2018-12-02 11:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-28  3:20 [PATCH 0/1] Fix NULL pointer access in PowerPC MSI teardown code Radu Rendec
2018-11-28  3:20 ` [PATCH 1/1] " Radu Rendec
2018-12-02 11:02   ` Michael Ellerman [this message]
2018-11-28 11:00 ` [PATCH 0/1] " Michael Ellerman
2018-11-28 15:15   ` Radu Rendec

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=4374vc6qfmz9sD4@ozlabs.org \
    --to=patch-notifications@ellerman.id.au \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=paulus@samba.org \
    --cc=radu.rendec@gmail.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;
as well as URLs for NNTP newsgroup(s).