mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 01:49:46 +00:00
proc: proc_maps_open allow proc_mem_open to return NULL
The commit65c6604725("proc: fix the issue of proc_mem_open returning NULL") caused proc_maps_open() to return -ESRCH when proc_mem_open() returns NULL. This breaks legitimate /proc/<pid>/maps access for kernel threads since kernel threads have NULL mm_struct. The regression causes perf to fail and exit when profiling a kernel thread: # perf record -v -g -p $(pgrep kswapd0) ... couldn't open /proc/65/task/65/maps This patch partially reverts the commit to fix it. Link: https://lkml.kernel.org/r/20250807165455.73656-1-wjl.linux@gmail.com Fixes:65c6604725("proc: fix the issue of proc_mem_open returning NULL") Signed-off-by: Jialin Wang <wjl.linux@gmail.com> Cc: Penglei Jiang <superman.xpt@gmail.com> Cc: <stable@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
committed by
Andrew Morton
parent
0b5be138ce
commit
c0e1b774f6
@@ -340,8 +340,8 @@ static int proc_maps_open(struct inode *inode, struct file *file,
|
||||
|
||||
priv->inode = inode;
|
||||
priv->mm = proc_mem_open(inode, PTRACE_MODE_READ);
|
||||
if (IS_ERR_OR_NULL(priv->mm)) {
|
||||
int err = priv->mm ? PTR_ERR(priv->mm) : -ESRCH;
|
||||
if (IS_ERR(priv->mm)) {
|
||||
int err = PTR_ERR(priv->mm);
|
||||
|
||||
seq_release_private(inode, file);
|
||||
return err;
|
||||
|
||||
Reference in New Issue
Block a user