linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fuse: fix memleak in cuse_channel_open
@ 2019-08-14  7:59 zhengbin
  2019-09-04  8:46 ` zhengbin (A)
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: zhengbin @ 2019-08-14  7:59 UTC (permalink / raw)
  To: mszeredi, ashish.samant, miklos, linux-fsdevel; +Cc: yi.zhang, zhengbin13

If cuse_send_init fails, need to fuse_conn_put cc->fc.

cuse_channel_open->fuse_conn_init->refcount_set(&fc->count, 1)
                 ->fuse_dev_alloc->fuse_conn_get
                 ->fuse_dev_free->fuse_conn_put

Fixes: cc080e9e9be1 ("fuse: introduce per-instance fuse_dev structure")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: zhengbin <zhengbin13@huawei.com>
---
 fs/fuse/cuse.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/fuse/cuse.c b/fs/fuse/cuse.c
index bab7a0d..f3b7208 100644
--- a/fs/fuse/cuse.c
+++ b/fs/fuse/cuse.c
@@ -519,6 +519,7 @@ static int cuse_channel_open(struct inode *inode, struct file *file)
 	rc = cuse_send_init(cc);
 	if (rc) {
 		fuse_dev_free(fud);
+		fuse_conn_put(&cc->fc);
 		return rc;
 	}
 	file->private_data = fud;
--
2.7.4


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

* Re: [PATCH] fuse: fix memleak in cuse_channel_open
  2019-08-14  7:59 [PATCH] fuse: fix memleak in cuse_channel_open zhengbin
@ 2019-09-04  8:46 ` zhengbin (A)
  2019-09-23  6:26 ` zhengbin (A)
  2019-09-23  7:04 ` Miklos Szeredi
  2 siblings, 0 replies; 4+ messages in thread
From: zhengbin (A) @ 2019-09-04  8:46 UTC (permalink / raw)
  To: mszeredi, ashish.samant, mszeredi, linux-fsdevel; +Cc: yi.zhang

ping

On 2019/8/14 15:59, zhengbin wrote:
> If cuse_send_init fails, need to fuse_conn_put cc->fc.
>
> cuse_channel_open->fuse_conn_init->refcount_set(&fc->count, 1)
>                  ->fuse_dev_alloc->fuse_conn_get
>                  ->fuse_dev_free->fuse_conn_put
>
> Fixes: cc080e9e9be1 ("fuse: introduce per-instance fuse_dev structure")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: zhengbin <zhengbin13@huawei.com>
> ---
>  fs/fuse/cuse.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/fs/fuse/cuse.c b/fs/fuse/cuse.c
> index bab7a0d..f3b7208 100644
> --- a/fs/fuse/cuse.c
> +++ b/fs/fuse/cuse.c
> @@ -519,6 +519,7 @@ static int cuse_channel_open(struct inode *inode, struct file *file)
>  	rc = cuse_send_init(cc);
>  	if (rc) {
>  		fuse_dev_free(fud);
> +		fuse_conn_put(&cc->fc);
>  		return rc;
>  	}
>  	file->private_data = fud;
> --
> 2.7.4
>
>
> .
>


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

* Re: [PATCH] fuse: fix memleak in cuse_channel_open
  2019-08-14  7:59 [PATCH] fuse: fix memleak in cuse_channel_open zhengbin
  2019-09-04  8:46 ` zhengbin (A)
@ 2019-09-23  6:26 ` zhengbin (A)
  2019-09-23  7:04 ` Miklos Szeredi
  2 siblings, 0 replies; 4+ messages in thread
From: zhengbin (A) @ 2019-09-23  6:26 UTC (permalink / raw)
  To: mszeredi, ashish.samant, miklos, linux-fsdevel

ping

On 2019/8/14 15:59, zhengbin wrote:
> If cuse_send_init fails, need to fuse_conn_put cc->fc.
>
> cuse_channel_open->fuse_conn_init->refcount_set(&fc->count, 1)
>                  ->fuse_dev_alloc->fuse_conn_get
>                  ->fuse_dev_free->fuse_conn_put
>
> Fixes: cc080e9e9be1 ("fuse: introduce per-instance fuse_dev structure")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: zhengbin <zhengbin13@huawei.com>
> ---
>  fs/fuse/cuse.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/fs/fuse/cuse.c b/fs/fuse/cuse.c
> index bab7a0d..f3b7208 100644
> --- a/fs/fuse/cuse.c
> +++ b/fs/fuse/cuse.c
> @@ -519,6 +519,7 @@ static int cuse_channel_open(struct inode *inode, struct file *file)
>  	rc = cuse_send_init(cc);
>  	if (rc) {
>  		fuse_dev_free(fud);
> +		fuse_conn_put(&cc->fc);
>  		return rc;
>  	}
>  	file->private_data = fud;
> --
> 2.7.4
>
>
> .
>


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

* Re: [PATCH] fuse: fix memleak in cuse_channel_open
  2019-08-14  7:59 [PATCH] fuse: fix memleak in cuse_channel_open zhengbin
  2019-09-04  8:46 ` zhengbin (A)
  2019-09-23  6:26 ` zhengbin (A)
@ 2019-09-23  7:04 ` Miklos Szeredi
  2 siblings, 0 replies; 4+ messages in thread
From: Miklos Szeredi @ 2019-09-23  7:04 UTC (permalink / raw)
  To: zhengbin; +Cc: mszeredi, Ashish Samant, linux-fsdevel, zhangyi (F)

On Wed, Aug 14, 2019 at 9:52 AM zhengbin <zhengbin13@huawei.com> wrote:
>
> If cuse_send_init fails, need to fuse_conn_put cc->fc.
>
> cuse_channel_open->fuse_conn_init->refcount_set(&fc->count, 1)
>                  ->fuse_dev_alloc->fuse_conn_get
>                  ->fuse_dev_free->fuse_conn_put
>
> Fixes: cc080e9e9be1 ("fuse: introduce per-instance fuse_dev structure")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: zhengbin <zhengbin13@huawei.com>

Thanks, applied.

Miklos

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

end of thread, other threads:[~2019-09-23  7:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-14  7:59 [PATCH] fuse: fix memleak in cuse_channel_open zhengbin
2019-09-04  8:46 ` zhengbin (A)
2019-09-23  6:26 ` zhengbin (A)
2019-09-23  7:04 ` Miklos Szeredi

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