fs/fuse kio: fix fuse_mutex leak in pcs_fuse_stat_fini()

Submitted by Pavel Butsykin on July 3, 2019, 12:09 p.m.

Details

Message ID 20190703120901.29557-1-pbutsykin@virtuozzo.com
State New
Series "fs/fuse kio: fix fuse_mutex leak in pcs_fuse_stat_fini()"
Headers show

Commit Message

Pavel Butsykin July 3, 2019, 12:09 p.m.
Signed-off-by: Pavel Butsykin <pbutsykin@virtuozzo.com>
---
 fs/fuse/kio/pcs/fuse_stat.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/fs/fuse/kio/pcs/fuse_stat.c b/fs/fuse/kio/pcs/fuse_stat.c
index bc3879d33de9..580f655e7567 100644
--- a/fs/fuse/kio/pcs/fuse_stat.c
+++ b/fs/fuse/kio/pcs/fuse_stat.c
@@ -848,8 +848,10 @@  fail1:
 void pcs_fuse_stat_fini(struct pcs_fuse_stat *stat)
 {
 	mutex_lock(&fuse_mutex);
-	if (!stat->kio_stat)
+	if (!stat->kio_stat) {
+		mutex_unlock(&fuse_mutex);
 		return;
+	}
 
 	if (fuse_control_sb) {
 		if (stat->iostat)
@@ -864,6 +866,7 @@  void pcs_fuse_stat_fini(struct pcs_fuse_stat *stat)
 			fuse_kio_rm_dentry(stat->cs_stats);
 		fuse_kio_rm_dentry(stat->kio_stat);
 	}
+	stat->kio_stat = NULL;
 	mutex_unlock(&fuse_mutex);
 
 	cancel_delayed_work_sync(&stat->work);

Comments

Andrey Zaitsev July 4, 2019, 8:37 a.m.
ok for me

03.07.2019 15:09, Pavel Butsykin пишет:
> Signed-off-by: Pavel Butsykin <pbutsykin@virtuozzo.com>
> ---
>   fs/fuse/kio/pcs/fuse_stat.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/fs/fuse/kio/pcs/fuse_stat.c b/fs/fuse/kio/pcs/fuse_stat.c
> index bc3879d33de9..580f655e7567 100644
> --- a/fs/fuse/kio/pcs/fuse_stat.c
> +++ b/fs/fuse/kio/pcs/fuse_stat.c
> @@ -848,8 +848,10 @@ fail1:
>   void pcs_fuse_stat_fini(struct pcs_fuse_stat *stat)
>   {
>   	mutex_lock(&fuse_mutex);
> -	if (!stat->kio_stat)
> +	if (!stat->kio_stat) {
> +		mutex_unlock(&fuse_mutex);
>   		return;
> +	}
>   
>   	if (fuse_control_sb) {
>   		if (stat->iostat)
> @@ -864,6 +866,7 @@ void pcs_fuse_stat_fini(struct pcs_fuse_stat *stat)
>   			fuse_kio_rm_dentry(stat->cs_stats);
>   		fuse_kio_rm_dentry(stat->kio_stat);
>   	}
> +	stat->kio_stat = NULL;
>   	mutex_unlock(&fuse_mutex);
>   
>   	cancel_delayed_work_sync(&stat->work);