Skip to content

Commit 341d51c

Browse files
lipeifeng-chinaakpm00
authored andcommitted
mm: nommu: correct the range of mmap_sem_read_lock in task_mem()
During the seq_printf,the mmap_sem_read_lock protection is not required. Link: https://lkml.kernel.org/r/20230622040152.1173-1-lipeifeng@oppo.com Signed-off-by: lipeifeng <lipeifeng@oppo.com> Cc: David Hildenbrand <david@redhat.com> Cc: Liam R. Howlett <Liam.Howlett@oracle.com> Cc: Matthew Wilcox <willy@infradead.org> Cc: Vlastimil Babka <vbabka@suse.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent fd4aed8 commit 341d51c

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

fs/proc/task_nommu.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ void task_mem(struct seq_file *m, struct mm_struct *mm)
5151
sbytes += kobjsize(mm);
5252
else
5353
bytes += kobjsize(mm);
54-
54+
5555
if (current->fs && current->fs->users > 1)
5656
sbytes += kobjsize(current->fs);
5757
else
@@ -69,13 +69,13 @@ void task_mem(struct seq_file *m, struct mm_struct *mm)
6969

7070
bytes += kobjsize(current); /* includes kernel stack */
7171

72+
mmap_read_unlock(mm);
73+
7274
seq_printf(m,
7375
"Mem:\t%8lu bytes\n"
7476
"Slack:\t%8lu bytes\n"
7577
"Shared:\t%8lu bytes\n",
7678
bytes, slack, sbytes);
77-
78-
mmap_read_unlock(mm);
7979
}
8080

8181
unsigned long task_vsize(struct mm_struct *mm)

0 commit comments

Comments
 (0)