[lkml]   [2015]   [Feb]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH 4/5] fs: efs: fix possible memory leak
On Thu, Feb 12, 2015 at 02:32:21PM +0530, Sudip Mukherjee wrote:
> we are allocating memory for struct efs_sb_info, but afterwards when
> we are returning with error we are not releasing the memory.

The hell we are not - unlike ->put_super(), ->kill_sb() is *always*
called, even when fill_super() fails halfway through. Exactly because
it makes for simpler cleanup requirements on failure exits in said
fill_super(). And we have
static void efs_kill_sb(struct super_block *s)
struct efs_sb_info *sbi = SUPER_INFO(s);
for ->kill_sb() there, so sbi will *not* leak.

NAK. This patch not only complicates efs_fill_super() for no good reason,
it ends up with double kfree() on those failure exits - ->s_fs_info is
left pointing to freed memory and efs_kill_sb() does kfree() again.

 \ /
  Last update: 2015-02-17 20:41    [W:0.085 / U:0.056 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site