From: Wolfram Sang <wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
To: Robin Murphy <robin.murphy-5wv7dgnIgG8@public.gmane.org>
Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-renesas-soc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Wolfram Sang
<wsa+renesas-jBu1N2QxHDJrcw3mvpCnnVaTQe2KTcn/@public.gmane.org>,
iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org,
Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Subject: Re: [RFC PATCH 3/3] dma-mapping: clear dma_parms on teardown, too
Date: Fri, 14 Sep 2018 17:57:06 +0200 [thread overview]
Message-ID: <20180914155706.GA906@kunai> (raw)
In-Reply-To: <874f7cd9-ac51-5968-de40-14a0addf9c96-5wv7dgnIgG8@public.gmane.org>
[-- Attachment #1.1: Type: text/plain, Size: 1116 bytes --]
On Fri, Sep 14, 2018 at 02:23:51PM +0100, Robin Murphy wrote:
> On 13/09/18 16:17, Wolfram Sang wrote:
> > While sanitizig the pointer for dma_ops on teardown, do the same for
> > dma_parms, too. Rename the function to have a more generic name.
>
> Upon closer inspection, it looks like there are some cases (at least PCI and
> MFD) where dma_parms is installed by the parent/bus at device creation, and
> therefore remains valid and *would* be expected to persist across the child
> device's driver unbinding and rebinding - seems this is more complex than I
> first thought, sorry.
No problem. I am thankful I understand more details. So, the life cycle
of dma_parms is truly that of the device. Which means that the drivers
using devm_kzalloc in their probe, should ideally clear the pointer on
unbind. Otherwise, it is not possible to say if the non-NULL dma_parms
is intended or dangling. Which makes my initial dmam_set_dma_parms()
approach look not too bad, I'd think?
However, I don't want to push hard with this one. If you think this is
too academic, I'll just leave it for now...
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
WARNING: multiple messages have this Message-ID (diff)
From: Wolfram Sang <wsa@the-dreams.de>
To: Robin Murphy <robin.murphy@arm.com>
Cc: Wolfram Sang <wsa+renesas@sang-engineering.com>,
iommu@lists.linux-foundation.org, Christoph Hellwig <hch@lst.de>,
linux-renesas-soc@vger.kernel.org,
Marek Szyprowski <m.szyprowski@samsung.com>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH 3/3] dma-mapping: clear dma_parms on teardown, too
Date: Fri, 14 Sep 2018 17:57:06 +0200 [thread overview]
Message-ID: <20180914155706.GA906@kunai> (raw)
In-Reply-To: <874f7cd9-ac51-5968-de40-14a0addf9c96@arm.com>
[-- Attachment #1: Type: text/plain, Size: 1116 bytes --]
On Fri, Sep 14, 2018 at 02:23:51PM +0100, Robin Murphy wrote:
> On 13/09/18 16:17, Wolfram Sang wrote:
> > While sanitizig the pointer for dma_ops on teardown, do the same for
> > dma_parms, too. Rename the function to have a more generic name.
>
> Upon closer inspection, it looks like there are some cases (at least PCI and
> MFD) where dma_parms is installed by the parent/bus at device creation, and
> therefore remains valid and *would* be expected to persist across the child
> device's driver unbinding and rebinding - seems this is more complex than I
> first thought, sorry.
No problem. I am thankful I understand more details. So, the life cycle
of dma_parms is truly that of the device. Which means that the drivers
using devm_kzalloc in their probe, should ideally clear the pointer on
unbind. Otherwise, it is not possible to say if the non-NULL dma_parms
is intended or dangling. Which makes my initial dmam_set_dma_parms()
approach look not too bad, I'd think?
However, I don't want to push hard with this one. If you think this is
too academic, I'll just leave it for now...
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
WARNING: multiple messages have this Message-ID (diff)
From: wsa@the-dreams.de (Wolfram Sang)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC PATCH 3/3] dma-mapping: clear dma_parms on teardown, too
Date: Fri, 14 Sep 2018 17:57:06 +0200 [thread overview]
Message-ID: <20180914155706.GA906@kunai> (raw)
In-Reply-To: <874f7cd9-ac51-5968-de40-14a0addf9c96@arm.com>
On Fri, Sep 14, 2018 at 02:23:51PM +0100, Robin Murphy wrote:
> On 13/09/18 16:17, Wolfram Sang wrote:
> > While sanitizig the pointer for dma_ops on teardown, do the same for
> > dma_parms, too. Rename the function to have a more generic name.
>
> Upon closer inspection, it looks like there are some cases (at least PCI and
> MFD) where dma_parms is installed by the parent/bus at device creation, and
> therefore remains valid and *would* be expected to persist across the child
> device's driver unbinding and rebinding - seems this is more complex than I
> first thought, sorry.
No problem. I am thankful I understand more details. So, the life cycle
of dma_parms is truly that of the device. Which means that the drivers
using devm_kzalloc in their probe, should ideally clear the pointer on
unbind. Otherwise, it is not possible to say if the non-NULL dma_parms
is intended or dangling. Which makes my initial dmam_set_dma_parms()
approach look not too bad, I'd think?
However, I don't want to push hard with this one. If you think this is
too academic, I'll just leave it for now...
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20180914/0e62acbc/attachment.sig>
next prev parent reply other threads:[~2018-09-14 15:57 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-13 15:17 [RFC PATCH 0/3] dma-mapping: clear dangling pointers consistently Wolfram Sang
2018-09-13 15:17 ` Wolfram Sang
2018-09-13 15:17 ` [RFC PATCH 1/3] ARM: dma-mapping: update comment about handling dma_ops when detaching from IOMMU Wolfram Sang
2018-09-13 15:17 ` Wolfram Sang
2018-09-14 12:15 ` Geert Uytterhoeven
2018-09-14 12:15 ` Geert Uytterhoeven
[not found] ` <CAMuHMdV_xpj62BkqwoTAaaugM3BkDRQTC=E0cEDqKBg3sUYNBg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-09-14 16:11 ` Wolfram Sang
2018-09-14 16:11 ` Wolfram Sang
2018-09-14 16:11 ` Wolfram Sang
2018-09-13 15:17 ` [RFC PATCH 2/3] dma-mapping: clear dma_ops pointer also on ARM Wolfram Sang
2018-09-13 15:17 ` Wolfram Sang
2018-09-14 13:12 ` Christoph Hellwig
2018-09-14 13:12 ` Christoph Hellwig
2018-09-13 15:17 ` [RFC PATCH 3/3] dma-mapping: clear dma_parms on teardown, too Wolfram Sang
2018-09-13 15:17 ` Wolfram Sang
2018-09-14 13:12 ` Christoph Hellwig
2018-09-14 13:12 ` Christoph Hellwig
2018-09-14 13:23 ` Robin Murphy
2018-09-14 13:23 ` Robin Murphy
[not found] ` <874f7cd9-ac51-5968-de40-14a0addf9c96-5wv7dgnIgG8@public.gmane.org>
2018-09-14 15:57 ` Wolfram Sang [this message]
2018-09-14 15:57 ` Wolfram Sang
2018-09-14 15:57 ` Wolfram Sang
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=20180914155706.GA906@kunai \
--to=wsa-z923lk4zbo2bacvfa/9k2g@public.gmane.org \
--cc=hch-jcswGhMUV9g@public.gmane.org \
--cc=iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
--cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-renesas-soc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=robin.murphy-5wv7dgnIgG8@public.gmane.org \
--cc=wsa+renesas-jBu1N2QxHDJrcw3mvpCnnVaTQe2KTcn/@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.