[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9a819530-365b-9982-c9c9-ad20d6c8149e@oracle.com>
Date: Tue, 15 Sep 2020 11:12:28 -0400
From: Thomas Tai <thomas.tai@...cle.com>
To: Christoph Hellwig <hch@....de>
Cc: konrad.wilk@...cle.com, m.szyprowski@...sung.com,
robin.murphy@....com, iommu@...ts.linux-foundation.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] dma-direct: Fix potential NULL pointer dereference
On 2020-09-15 11:09 a.m., Christoph Hellwig wrote:
> On Tue, Sep 15, 2020 at 10:40:39AM -0400, Thomas Tai wrote:
>>> +++ b/include/linux/dma-direct.h
>>> @@ -62,9 +62,6 @@ static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size,
>>> {
>>> dma_addr_t end = addr + size - 1;
>>> - if (!dev->dma_mask)
>>> - return false;
>>> -
>>
>> I am concerned that some drivers may rely on this NULL checking. Would you
>> think we can keep this checking and use the following WARN_ON_ONCE()?
>
> dma_capable is not a helper for drivers, but just for dma-direct
> and related code. And this patch adds the checks for the three
> places how we call into the ->map* methods.
>
Ok. That sounds good to me. I will make the suggested changes and run
some tests before sending out the V2 patch.
Thank you,
Thomas
Powered by blists - more mailing lists