[Devel] [PATCH] fs/fuse kio: set NULL to stat->kio_stat in failure case

Pavel Butsykin pbutsykin at virtuozzo.com
Thu Jul 4 12:29:41 MSK 2019


At the beginning of the initialization, 'stat' struct may contain garbage, so
if pcs_fuse_stat_init() fails before stat->kio_stat field is initialized, there
may be garbage in stat->kio_stat, which can lead to a crash due to an invalid
address access.

Signed-off-by: Pavel Butsykin <pbutsykin at virtuozzo.com>
---
 fs/fuse/kio/pcs/fuse_stat.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/fuse/kio/pcs/fuse_stat.c b/fs/fuse/kio/pcs/fuse_stat.c
index 580f655e7567..8bef965f8037 100644
--- a/fs/fuse/kio/pcs/fuse_stat.c
+++ b/fs/fuse/kio/pcs/fuse_stat.c
@@ -842,6 +842,7 @@ void pcs_fuse_stat_init(struct pcs_fuse_stat *stat)
 fail2:
 	pcs_fuse_io_stat_free(&stat->io);
 fail1:
+	stat->kio_stat = NULL;
 	mutex_unlock(&fuse_mutex);
 }
 
-- 
2.15.1



More information about the Devel mailing list