mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-08 12:58:12 -04:00
moto_mmap_fault:Protect the pointer
Check the pointers first Before access them later Change-Id: I96291862ad7990d3a6b57c4b864959ffe13f932b Signed-off-by: William Liu <a17671@motorola.com> Reviewed-on: https://gerrit.mot.com/2646282 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Xiangpo Zhao <zhaoxp3@motorola.com> Submit-Approved: Jira Key Reviewed-on: https://gerrit.mot.com/2676237 Reviewed-by: Huosheng Liao <liaohs@motorola.com>
This commit is contained in:
parent
332e5a78de
commit
d06ffd55fe
1 changed files with 19 additions and 3 deletions
|
|
@ -33,11 +33,19 @@ static void __nocfi filemap_fault_get_page(void *p, struct vm_fault *vmf, struct
|
|||
struct file *file = vmf->vma->vm_file;
|
||||
pgoff_t offset = vmf->pgoff;
|
||||
struct page *page = NULL;
|
||||
struct file_ra_state *ra = &file->f_ra;
|
||||
struct address_space *mapping = file->f_mapping;
|
||||
struct file_ra_state *ra = NULL;
|
||||
struct address_space *mapping = NULL;
|
||||
unsigned int mmap_miss;
|
||||
unsigned int old_ra_pages = 0;
|
||||
|
||||
if (!file)
|
||||
return;
|
||||
|
||||
ra = &file->f_ra;
|
||||
if(!ra)
|
||||
return;
|
||||
|
||||
mapping = file->f_mapping;
|
||||
if (page_cache_get_page_func)
|
||||
page = page_cache_get_page_func(mapping, offset, 0, 0);
|
||||
|
||||
|
|
@ -69,7 +77,15 @@ static void __nocfi filemap_fault_get_page(void *p, struct vm_fault *vmf, struct
|
|||
static void __nocfi filemap_fault_cache_page(void *p, struct vm_fault *vmf, struct page *page)
|
||||
{
|
||||
struct file *file = vmf->vma->vm_file;
|
||||
struct file_ra_state *ra = &file->f_ra;
|
||||
struct file_ra_state *ra = NULL;
|
||||
|
||||
if (!file)
|
||||
return;
|
||||
|
||||
ra = &file->f_ra;
|
||||
if(!ra)
|
||||
return;
|
||||
|
||||
if ((ra->ra_pages == max_ra_pages) && (vmf->android_oem_data1[0] != 0) && (vmf->android_oem_data1[1] != 0)) {
|
||||
ra->ra_pages = (unsigned long)vmf->android_oem_data1[0]; //restore the old ra_pages
|
||||
vmf->android_oem_data1[0] = 0;
|
||||
|
|
|
|||
Loading…
Reference in a new issue