Linux-Fsdevel Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH RESEND] 9p: Fix memory leak in v9fs_mount
@ 2020-06-15  1:21 Zheng Bin
  2020-06-15 10:20 ` Dominique Martinet
  0 siblings, 1 reply; 4+ messages in thread
From: Zheng Bin @ 2020-06-15  1:21 UTC (permalink / raw)
  To: ericvh, lucho, asmadeus, v9fs-developer, linux-fsdevel, linux-kernel
  Cc: yi.zhang, zhengbin13

v9fs_mount
  v9fs_session_init
    v9fs_cache_session_get_cookie
      v9fs_random_cachetag                     -->alloc cachetag
      v9ses->fscache = fscache_acquire_cookie  -->maybe NULL
  sb = sget                                    -->fail, goto clunk
clunk_fid:
  v9fs_session_close
    if (v9ses->fscache)                        -->NULL
      kfree(v9ses->cachetag)

Thus memleak happens.

Signed-off-by: Zheng Bin <zhengbin13@huawei.com>
---
 fs/9p/v9fs.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/fs/9p/v9fs.c b/fs/9p/v9fs.c
index 15a99f9c7253..39def020a074 100644
--- a/fs/9p/v9fs.c
+++ b/fs/9p/v9fs.c
@@ -500,10 +500,9 @@ void v9fs_session_close(struct v9fs_session_info *v9ses)
 	}

 #ifdef CONFIG_9P_FSCACHE
-	if (v9ses->fscache) {
+	if (v9ses->fscache)
 		v9fs_cache_session_put_cookie(v9ses);
-		kfree(v9ses->cachetag);
-	}
+	kfree(v9ses->cachetag);
 #endif
 	kfree(v9ses->uname);
 	kfree(v9ses->aname);
--
2.26.0.106.g9fadedd


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

* Re: [PATCH RESEND] 9p: Fix memory leak in v9fs_mount
  2020-06-15  1:21 [PATCH RESEND] 9p: Fix memory leak in v9fs_mount Zheng Bin
@ 2020-06-15 10:20 ` Dominique Martinet
  2020-07-09  2:04   ` Zhengbin (OSKernel)
  0 siblings, 1 reply; 4+ messages in thread
From: Dominique Martinet @ 2020-06-15 10:20 UTC (permalink / raw)
  To: Zheng Bin
  Cc: ericvh, lucho, v9fs-developer, linux-fsdevel, linux-kernel, yi.zhang

Zheng Bin wrote on Mon, Jun 15, 2020:
> v9fs_mount
>   v9fs_session_init
>     v9fs_cache_session_get_cookie
>       v9fs_random_cachetag                     -->alloc cachetag
>       v9ses->fscache = fscache_acquire_cookie  -->maybe NULL
>   sb = sget                                    -->fail, goto clunk
> clunk_fid:
>   v9fs_session_close
>     if (v9ses->fscache)                        -->NULL
>       kfree(v9ses->cachetag)
> 
> Thus memleak happens.
> 
> Signed-off-by: Zheng Bin <zhengbin13@huawei.com>

Thanks, will run tests & queue next weekend

-- 
Dominique

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

* Re: [PATCH RESEND] 9p: Fix memory leak in v9fs_mount
  2020-06-15 10:20 ` Dominique Martinet
@ 2020-07-09  2:04   ` Zhengbin (OSKernel)
  2020-07-10 11:05     ` Dominique Martinet
  0 siblings, 1 reply; 4+ messages in thread
From: Zhengbin (OSKernel) @ 2020-07-09  2:04 UTC (permalink / raw)
  To: Dominique Martinet
  Cc: ericvh, lucho, v9fs-developer, linux-fsdevel, linux-kernel, yi.zhang

Is this OK? I don't see it on linux-next

On 2020/6/15 18:20, Dominique Martinet wrote:
> Zheng Bin wrote on Mon, Jun 15, 2020:
>> v9fs_mount
>>    v9fs_session_init
>>      v9fs_cache_session_get_cookie
>>        v9fs_random_cachetag                     -->alloc cachetag
>>        v9ses->fscache = fscache_acquire_cookie  -->maybe NULL
>>    sb = sget                                    -->fail, goto clunk
>> clunk_fid:
>>    v9fs_session_close
>>      if (v9ses->fscache)                        -->NULL
>>        kfree(v9ses->cachetag)
>>
>> Thus memleak happens.
>>
>> Signed-off-by: Zheng Bin <zhengbin13@huawei.com>
> Thanks, will run tests & queue next weekend
>


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

* Re: [PATCH RESEND] 9p: Fix memory leak in v9fs_mount
  2020-07-09  2:04   ` Zhengbin (OSKernel)
@ 2020-07-10 11:05     ` Dominique Martinet
  0 siblings, 0 replies; 4+ messages in thread
From: Dominique Martinet @ 2020-07-10 11:05 UTC (permalink / raw)
  To: Zhengbin (OSKernel)
  Cc: ericvh, lucho, v9fs-developer, linux-fsdevel, linux-kernel, yi.zhang

Zhengbin (OSKernel) wrote on Thu, Jul 09, 2020:
> Is this OK? I don't see it on linux-next

Yes, I just (still) haven't tested them, sorry.
It's in git://github.com/martinetd/linux branch 9p-test

-- 
Dominique

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

end of thread, other threads:[~2020-07-10 11:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-15  1:21 [PATCH RESEND] 9p: Fix memory leak in v9fs_mount Zheng Bin
2020-06-15 10:20 ` Dominique Martinet
2020-07-09  2:04   ` Zhengbin (OSKernel)
2020-07-10 11:05     ` Dominique Martinet

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