linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH v2] exfat: fix memory leak in exfat_parse_param()
@ 2020-06-03  6:30 Markus Elfring
  0 siblings, 0 replies; 2+ messages in thread
From: Markus Elfring @ 2020-06-03  6:30 UTC (permalink / raw)
  To: Namjae Jeon, linux-fsdevel
  Cc: linux-kernel, kernel-janitors, stable, syzkaller, Al Viro,
	Sungjong Seo, Xiaolong Huang

> Additionally, there's no point copying param->string in
> exfat_parse_param() - just steal it, leaving NULL in param->string.
> That's independent from the leak or fix thereof - it's simply
> avoiding an extra copy.

I find it clearer to provide such a source code adjustment
by a separate update step.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?id=d6f9469a03d832dcd17041ed67774ffb5f3e73b3#n138

Please move it into another patch.


…
> +++ b/fs/exfat/super.c
> @@ -686,7 +685,12 @@  static int exfat_get_tree(struct fs_context *fc)
>
>  static void exfat_free(struct fs_context *fc)
>  {
> -	kfree(fc->s_fs_info);
> +	struct exfat_sb_info *sbi = fc->s_fs_info;
> +
> +	if (sbi) {
> +		exfat_free_iocharset(sbi);
> +		kfree(sbi);
> +	}
>  }
…

Can it be helpful to annotate the added check according to branch prediction?
Are valid pointers likely at this place?

Regards,
Markus

^ permalink raw reply	[flat|nested] 2+ messages in thread
[parent not found: <CGME20200603021436epcas1p28e26eaba7140c222c9ed09b86a489b58@epcas1p2.samsung.com>]

end of thread, other threads:[~2020-06-03  6:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-03  6:30 [PATCH v2] exfat: fix memory leak in exfat_parse_param() Markus Elfring
     [not found] <CGME20200603021436epcas1p28e26eaba7140c222c9ed09b86a489b58@epcas1p2.samsung.com>
2020-06-03  2:09 ` Namjae Jeon

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