mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 10:41:38 -04:00
fs/proc/kcore.c: fix invalid memory access in multi-page read optimization
The 'm' kcore_list item could point to kclist_head, and it is incorrect to
look at m->addr / m->size in this case.
There is no choice but to run through the list of entries for every
address if we did not find any entry in the previous iteration
Reset 'm' to NULL in that case at Omar Sandoval's suggestion.
[[email protected]: add comment]
Link: http://lkml.kernel.org/r/[email protected]
Fixes: bf991c2231 ("proc/kcore: optimize multiple page reads")
Signed-off-by: Dominique Martinet <[email protected]>
Reviewed-by: Andrew Morton <[email protected]>
Cc: Omar Sandoval <[email protected]>
Cc: Alexey Dobriyan <[email protected]>
Cc: Eric Biederman <[email protected]>
Cc: James Morse <[email protected]>
Cc: Bhupesh Sharma <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
This commit is contained in:
parent
889c695d41
commit
a1b3d2f217
1 changed files with 1 additions and 0 deletions
|
|
@ -464,6 +464,7 @@ read_kcore(struct file *file, char __user *buffer, size_t buflen, loff_t *fpos)
|
|||
ret = -EFAULT;
|
||||
goto out;
|
||||
}
|
||||
m = NULL; /* skip the list anchor */
|
||||
} else if (m->type == KCORE_VMALLOC) {
|
||||
vread(buf, (char *)start, tsz);
|
||||
/* we have to zero-fill user buffer even if no read */
|
||||
|
|
|
|||
Loading…
Reference in a new issue