aboutsummaryrefslogtreecommitdiffstats
path: root/lib/dma-debug.c
diff options
context:
space:
mode:
authorJeff Moyer <[email protected]>2017-11-15 01:37:27 +0000
committerDan Williams <[email protected]>2017-11-15 04:16:55 +0000
commit957ac8c421ad8b5eef9b17fe98e146d8311a541e (patch)
treee12715f967f9d8c3e44929fd253eee4c45d1e821 /lib/dma-debug.c
parentdax: stop requiring a live device for dax_flush() (diff)
downloadkernel-957ac8c421ad8b5eef9b17fe98e146d8311a541e.tar.gz
kernel-957ac8c421ad8b5eef9b17fe98e146d8311a541e.zip
dax: fix PMD faults on zero-length files
PMD faults on a zero length file on a file system mounted with -o dax will not generate SIGBUS as expected. fd = open(...O_TRUNC); addr = mmap(NULL, 2*1024*1024, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0); *addr = 'a'; <expect SIGBUS> The problem is this code in dax_iomap_pmd_fault: max_pgoff = (i_size_read(inode) - 1) >> PAGE_SHIFT; If the inode size is zero, we end up with a max_pgoff that is way larger than 0. :) Fix it by using DIV_ROUND_UP, as is done elsewhere in the kernel. I tested this with some simple test code that ensured that SIGBUS was received where expected. Cc: <[email protected]> Fixes: 642261ac995e ("dax: add struct iomap based DAX PMD support") Signed-off-by: Jeff Moyer <[email protected]> Signed-off-by: Dan Williams <[email protected]>
Diffstat (limited to 'lib/dma-debug.c')
0 files changed, 0 insertions, 0 deletions