From: Logan Gunthorpe <firstname.lastname@example.org>
To: Vinod Koul <email@example.com>
Cc: firstname.lastname@example.org, email@example.com,
Dan Williams <firstname.lastname@example.org>
Subject: Re: [PATCH 1/5] dmaengine: Store module owner in dma_device struct
Date: Tue, 12 Nov 2019 09:45:01 -0700 [thread overview]
Message-ID: <email@example.com> (raw)
On 2019-11-11 10:56 p.m., Vinod Koul wrote:
> On 11-11-19, 09:50, Logan Gunthorpe wrote:
>> On 2019-11-09 10:18 a.m., Vinod Koul wrote:
>>> Hi Logan,
>>> Sorry for delay in reply!
>>> On 22-10-19, 15:46, Logan Gunthorpe wrote:
>>>> dma_chan_to_owner() dereferences the driver from the struct device to
>>>> obtain the owner and call module_[get|put](). However, if the backing
>>>> device is unbound before the dma_device is unregistered, the driver
>>>> will be cleared and this will cause a NULL pointer dereference.
>>> Have you been able to repro this? If so how..?
>>> The expectation is that the driver shall unregister before removed.
>> Yes, with my new driver, if I do a PCI unbind (which unregisters) while
>> the DMA engine is in use, it panics. The point is the underlying driver
>> can go away before the channel is removed.
> and in your driver remove you do not unregister? When unbind is invoked
> the driver remove is invoked by core and you should unregister whatever
> you have registered in your probe!
> Said that, if someone is using the dmaengine at that point of time, it
> is not a nice thing to do and can cause issues, but on idle it should
> just work!
But that's the problem. We can't expect our users to be "nice" and not
unbind when the driver is in use. Killing the kernel if the user
unexpectedly unbinds is not acceptable.
>> I suspect this is less of an issue for most devices as they wouldn't
>> normally be unbound while in use (for example there's really no reason
>> to ever unbind IOAT seeing it's built into the system). Though, the fact
>> is, the user could unbind these devices at anytime and we don't want to
>> panic if they do.
> There are many drivers which do modules so yes I am expecting unbind and
> even a bind following that to work
Except they will panic if they unbind while in use, so that's a
questionable definition of "work".
next prev parent reply other threads:[~2019-11-12 16:45 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-22 21:46 [PATCH 0/5] PLX Switch DMA Engine Driver Logan Gunthorpe
2019-10-22 21:46 ` [PATCH 1/5] dmaengine: Store module owner in dma_device struct Logan Gunthorpe
2019-11-09 17:18 ` Vinod Koul
2019-11-11 16:50 ` Logan Gunthorpe
2019-11-12 5:56 ` Vinod Koul
2019-11-12 16:45 ` Logan Gunthorpe [this message]
2019-11-14 4:55 ` Vinod Koul
2019-11-14 17:03 ` Logan Gunthorpe
2019-11-22 5:20 ` Vinod Koul
2019-11-22 16:53 ` Dave Jiang
2019-11-22 20:50 ` Dan Williams
2019-11-22 20:56 ` Logan Gunthorpe
2019-11-22 21:01 ` Dan Williams
2019-11-22 21:42 ` Dave Jiang
2019-12-10 9:53 ` Vinod Koul
2019-12-10 17:39 ` Logan Gunthorpe
2019-10-22 21:46 ` [PATCH 2/5] dmaengine: Call module_put() after device_free_chan_resources() Logan Gunthorpe
2019-10-22 21:46 ` [PATCH 3/5] dmaengine: plx-dma: Introduce PLX DMA engine PCI driver skeleton Logan Gunthorpe
2019-11-09 17:35 ` Vinod Koul
2019-11-11 17:50 ` Logan Gunthorpe
2019-11-12 6:09 ` Vinod Koul
2019-11-12 17:22 ` Logan Gunthorpe
2019-10-22 21:46 ` [PATCH 4/5] dmaengine: plx-dma: Implement hardware initialization and cleanup Logan Gunthorpe
2019-10-22 21:46 ` [PATCH 5/5] dmaengine: plx-dma: Implement descriptor submission Logan Gunthorpe
2019-11-09 17:40 ` Vinod Koul
2019-11-11 18:11 ` Logan Gunthorpe
2019-12-16 19:01 [PATCH 0/5] Support hot-unbind in IOAT Logan Gunthorpe
2019-12-16 19:01 ` [PATCH 1/5] dmaengine: Store module owner in dma_device struct Logan Gunthorpe
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:
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
* 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).