lkml.org 
[lkml]   [2018]   [Aug]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] swiotlb: Fix uninitialized pointer on DMA ops
From
On August 18, 2018 3:04:51 PM EDT, Esteban Zamora <estebanzacr.20@gmail.com> wrote:
>The mmap function pointer on swiotlb_dma_ops struct is
>uninitialized, which causes a random crash when calling
>the dma_mmap_coherent function on platforms where no DMA
>address translation hardware is available.
>
>Set this pointer to NULL in order to fix the issue.


By default unused entries in .rodata structure (like this one) are zero - meaning they are NULL if not set by the complier.

You should be able to verify this by looking at the objdump of the kernel and find this structure.


>
>Signed-off-by: Esteban Zamora <estebanzacr.20@gmail.com>
>---
> kernel/dma/swiotlb.c | 1 +
> 1 file changed, 1 insertion(+)
>
>diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c
>index 4f8a6db..9a7718c 100644
>--- a/kernel/dma/swiotlb.c
>+++ b/kernel/dma/swiotlb.c
>@@ -1082,5 +1082,6 @@ const struct dma_map_ops swiotlb_dma_ops = {
> .map_page = swiotlb_map_page,
> .unmap_page = swiotlb_unmap_page,
> .dma_supported = dma_direct_supported,
>+ .mmap = NULL,
> };
> EXPORT_SYMBOL(swiotlb_dma_ops);

\
 
 \ /
  Last update: 2018-08-19 14:58    [W:0.059 / U:2.596 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site