+ dax-fix-null-pointer-in-__dax_pmd_fault.patch tentatively added to -mm tree
Subsystems (2)
The patch titled
Subject: dax: fix NULL pointer in __dax_pmd_fault()
has been added to the -mm tree. Its filename is
dax-fix-null-pointer-in-__dax_pmd_fault.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/dax-fix-null-pointer-in-__dax_pmd_fault.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/dax-fix-null-pointer-in-__dax_pmd_fault.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/SubmitChecklist when testing your code ***
The -mm tree is included into linux-next and is updated there every 3-4 working days
------------------------------------------------------
From: Ross Zwisler <[email protected]>
Subject: dax: fix NULL pointer in __dax_pmd_fault()
46c043ede471 ("mm: take i_mmap_lock in unmap_mapping_range() for DAX") moved some code in __dax_pmd_fault() that was responsible for zeroing newly allocated PMD pages. The new location didn't properly set up 'kaddr', so when run this code resulted in a NULL pointer BUG.
Fix this by getting the correct 'kaddr' via bdev_direct_access().
---
fs/dax.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
fs/dax.c renamed from fs/dax.c~dax-fix-null-pointer-in-__dax_pmd_fault +12 -1
@@ -569,8 +569,20 @@ int __dax_pmd_fault(struct vm_area_strucif (!buffer_size_valid (&bh) || bh.b_size <PMD_SIZE ) goto fallback; + sector = bh.b_blocknr << (blkbits -9 ); +if (buffer_unwritten (&bh) ||buffer_new (&bh)) {int i; + + length =bdev_direct_access (bh.b_bdev, sector, &kaddr, &pfn, + bh.b_size); +if (length <0 ) { + result =VM_FAULT_SIGBUS ; + goto out; + } +if ((length <PMD_SIZE ) || (pfn &PG_PMD_COLOUR )) + goto fallback; +for (i =0 ; i <PTRS_PER_PMD ; i++)clear_pmem (kaddr + i *PAGE_SIZE ,PAGE_SIZE );wmb_pmem ();
@@ -623,7 +635,6 @@ int __dax_pmd_fault(struct vm_area_struc result =VM_FAULT_NOPAGE ;spin_unlock (ptl); }else { - sector = bh.b_blocknr << (blkbits -9 ); length =bdev_direct_access (bh.b_bdev, sector, &kaddr, &pfn, bh.b_size);if (length <0 ) {
_
Patches currently in -mm which might be from [email protected] are
dax-fix-null-pointer-in-__dax_pmd_fault.patch