linux-staging.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH] staging: android: ashmem: add size field in procfs fdinfo
@ 2021-06-18  9:50 liuhailong
  2021-06-18 10:23 ` Greg KH
  0 siblings, 1 reply; 5+ messages in thread
From: liuhailong @ 2021-06-18  9:50 UTC (permalink / raw)
  To: gregkh, arve, tkjos, maco, joel, christian, hridya, surenb
  Cc: linux-kernel, linux-staging, liuhailong

add this information to help user to find ashmem problem.

ashmem leak scenario:
-000|fd = ashmem_create_region
-001|mmap and pagefault
-002|munmap
-003|forget close(fd) <---- which lead to ashmem leak

Signed-off-by: liuhailong <liuhailong@oppo.com>
---
 drivers/staging/android/ashmem.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/staging/android/ashmem.c b/drivers/staging/android/ashmem.c
index d66a64e42273..ee2fd75111d8 100644
--- a/drivers/staging/android/ashmem.c
+++ b/drivers/staging/android/ashmem.c
@@ -894,6 +894,8 @@ static void ashmem_show_fdinfo(struct seq_file *m, struct file *file)
 		seq_printf(m, "name:\t%s\n",
 			   asma->name + ASHMEM_NAME_PREFIX_LEN);
 
+	seq_printf(m, "size:\t%zu\n", asma->size);
+
 	mutex_unlock(&ashmem_mutex);
 }
 #endif
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-06-18 11:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-18  9:50 [PATCH] staging: android: ashmem: add size field in procfs fdinfo liuhailong
2021-06-18 10:23 ` Greg KH
2021-06-18 10:40   ` 回复: " 刘海龙(DuckBuBee)
2021-06-18 11:04     ` Greg KH
2021-06-18 11:04   ` 刘海龙(DuckBuBee)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).