Re: [PATCH v2] exfat: fix memory leak in exfat_parse_param()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 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




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux