linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next v3 0/2] jffs2: fix two memory leak when mount jffs2
@ 2022-01-14 10:28 Baokun Li
  2022-01-14 10:28 ` [PATCH -next v3 1/2] jffs2: fix memory leak in jffs2_do_mount_fs Baokun Li
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Baokun Li @ 2022-01-14 10:28 UTC (permalink / raw)
  To: richard, dwmw2, linux-mtd, linux-kernel; +Cc: libaokun1, yukuai3

V1->V2:
	In jffs2_scan_medium,
	if s = kzalloc(sizeof(struct jffs2_summary), GFP_KERNEL);
	returns error, go to "out" to do clear. Null pointer dereference
	occurs when if (s->sum_list_head) is executed in "out".

V2->V3:
	Sorry for the noise, but there seems to be a more elegant way to
	fix the memory leak in jffs2_scan_medium. When memory allocation
	fails or CONFIG_JFFS2_SUMMARY is N, s is NULL.For the former case,
	add the new tag "out_buf" to avoid it.In the latter case,
	jffs2_sum_reset_collected is also an empty function and does nothing.

Baokun Li (2):
  jffs2: fix memory leak in jffs2_do_mount_fs
  jffs2: fix memory leak in jffs2_scan_medium

 fs/jffs2/build.c | 4 +++-
 fs/jffs2/scan.c  | 6 ++++--
 2 files changed, 7 insertions(+), 3 deletions(-)

-- 
2.31.1


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

end of thread, other threads:[~2022-03-17  1:40 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-14 10:28 [PATCH -next v3 0/2] jffs2: fix two memory leak when mount jffs2 Baokun Li
2022-01-14 10:28 ` [PATCH -next v3 1/2] jffs2: fix memory leak in jffs2_do_mount_fs Baokun Li
2022-01-14 10:28 ` [PATCH -next v3 2/2] jffs2: fix memory leak in jffs2_scan_medium Baokun Li
2022-02-18  6:14 ` [PATCH -next v3 0/2] jffs2: fix two memory leak when mount jffs2 libaokun (A)
2022-03-10  8:34 ` libaokun (A)
2022-03-16 22:00   ` Richard Weinberger
2022-03-17  1:39     ` libaokun (A)

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).