Changeset 560b81c in mainline for kernel/generic/src/mm/as.c


Ignore:
Timestamp:
2016-09-17T15:09:40Z (8 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
ae66564
Parents:
97b8ca9
Message:

Make sure to test the present bit of the found PTE

By design, page_mapping_find() can return true and a copy of a PTE
which is not present. It is therefore necessary to test the found PTE
by PTE_PRESENT() macro.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/mm/as.c

    r97b8ca9 r560b81c  
    14571457        pte_t pte;
    14581458        bool found = page_mapping_find(AS, page, false, &pte);
    1459         if (found) {
    1460                 if (PTE_PRESENT(&pte)) {
    1461                         if (((access == PF_ACCESS_READ) && PTE_READABLE(&pte)) ||
    1462                             (access == PF_ACCESS_WRITE && PTE_WRITABLE(&pte)) ||
    1463                             (access == PF_ACCESS_EXEC && PTE_EXECUTABLE(&pte))) {
    1464                                 page_table_unlock(AS, false);
    1465                                 mutex_unlock(&area->lock);
    1466                                 mutex_unlock(&AS->lock);
    1467                                 return AS_PF_OK;
    1468                         }
     1459        if (found && PTE_PRESENT(&pte)) {
     1460                if (((access == PF_ACCESS_READ) && PTE_READABLE(&pte)) ||
     1461                    (access == PF_ACCESS_WRITE && PTE_WRITABLE(&pte)) ||
     1462                    (access == PF_ACCESS_EXEC && PTE_EXECUTABLE(&pte))) {
     1463                        page_table_unlock(AS, false);
     1464                        mutex_unlock(&area->lock);
     1465                        mutex_unlock(&AS->lock);
     1466                        return AS_PF_OK;
    14691467                }
    14701468        }
Note: See TracChangeset for help on using the changeset viewer.