From: Mathias Nyman <mathias.nyman@linux.intel.com>
To: "Schmid, Carsten" <Carsten_Schmid@mentor.com>
Cc: Hans de Goede <hdegoede@redhat.com>,
"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>
Subject: Re: [Resend] [PATCH v3] usb: xhci-pci: reorder removal to avoid use-after-free
Date: Thu, 22 Aug 2019 18:23:32 +0300 [thread overview]
Message-ID: <fbbf1ed3-c0c0-9b34-aeec-32a6f3645d7b@linux.intel.com> (raw)
In-Reply-To: <1565946200239.8897@mentor.com>
On 16.8.2019 12.03, Schmid, Carsten wrote:
> On driver removal, the platform_device_unregister call
> attached through devm_add_action_or_reset was executed
> after usb_hcd_pci_remove.
> This lead to a use-after-free for the iomem resource of
> the xhci-ext-caps driver in the platform removal
> because the parent of the resource was freed earlier.
>
> Fix this by reordering of the removal sequence.
>
Could all this be avoided if usb_hcd_pci_probe()
used managed device resources as well?
(using devm_request_mem_region(), and devm_ioremap_nocache())
This way the iomem resource would be added to the same devres list
as the platform_unregister_call, and the iomem resource should be
released after the platform_device_unregister as devres_release_all()
releases the resources in reverse order.
-Mathias
next prev parent reply other threads:[~2019-08-22 15:21 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-16 9:03 [Resend] [PATCH v3] usb: xhci-pci: reorder removal to avoid use-after-free Schmid, Carsten
2019-08-22 15:23 ` Mathias Nyman [this message]
2019-08-22 15:25 ` Hans de Goede
2019-08-22 15:48 ` AW: " Schmid, Carsten
2019-08-22 20:14 ` Hans de Goede
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=fbbf1ed3-c0c0-9b34-aeec-32a6f3645d7b@linux.intel.com \
--to=mathias.nyman@linux.intel.com \
--cc=Carsten_Schmid@mentor.com \
--cc=hdegoede@redhat.com \
--cc=linux-usb@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;
as well as URLs for NNTP newsgroup(s).