Fix lseek on /proc/kcore
PATCH 1/1 Fix lseek on /proc/kcore
---
fs/proc/inode.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
fs/proc/inode.c +3 -2
@@ -167,8 +167,9 @@ static loff_t proc_reg_llseek(struct fil llseek = pde->proc_fops->llseek;spin_unlock (&pde->pde_unload_lock); -if (llseek) - rv =llseek (file, offset, whence); +if (!llseek) + llseek = default_llseek; + rv =llseek (file, offset, whence);spin_lock (&pde->pde_unload_lock); pde->pde_users--;
Quoted 9 lines · Alexey Dobriyan
Signed-off-by Alexey Dobriyan <[email protected]>---
fs/proc/inode.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
fs/proc/inode.c static loff_t proc_reg_llseek(struct fil · line 173
Quoted 9 lines
fs/proc/inode.c +3
-2@@ -167,8 +167,9 @@ static loff_t proc_reg_llseek(struct fil llseek = pde->proc_fops->llseek;spin_unlock (&pde->pde_unload_lock); -if (llseek) - rv =llseek (file, offset, whence); +if (!llseek) + llseek = default_llseek; + rv =llseek (file, offset, whence);
this has potential impact way outside kcore......
did you audit all proc users to see if they can deal with lseek?
Quoted 16 lines · Arjan van de Ven
fs/proc/inode.c static loff_t proc_reg_llseek(struct fil · line 173
Quoted 12 lines · Alexey Dobriyan
fs/proc/inode.c +3
-2@@ -167,8 +167,9 @@ static loff_t proc_reg_llseek(struct fil llseek = pde->proc_fops->llseek;spin_unlock (&pde->pde_unload_lock); -if (llseek) - rv =llseek (file, offset, whence); +if (!llseek) + llseek = default_llseek; + rv =llseek (file, offset, whence);this has potential impact way outside kcore......
Quoted 1 line
did you audit all proc users to see if they can deal with lseek?
Mainline deals with lseek on proc entries as follows:
* use default_llseek()
* but if proc entry set ->llseek via ->proc_fops, use custom llseek
With introduction of proxying, ->llseek was suddenly set on all proc entries, so default_llseek() was never used, but -E started to be returned for all of them that were relying on default_llseek().
So this patch brings proc_reg_llseek() in sync with vfs_llseek().