diff options
author | Mateusz Jurczyk <mjurczyk@google.com> | 2017-06-07 12:26:49 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-08-16 13:43:17 -0700 |
commit | 227559e6233c9af382efcfd4c9ac87e090bb4853 (patch) | |
tree | 6369dd7444667c08cf4a3f08bdd89b910cab9a98 /fs/fuse/file.c | |
parent | 1da30c23b63b3ed426880ac11179dbc2d2bbf368 (diff) | |
download | linux-stable-227559e6233c9af382efcfd4c9ac87e090bb4853.tar.gz linux-stable-227559e6233c9af382efcfd4c9ac87e090bb4853.tar.bz2 linux-stable-227559e6233c9af382efcfd4c9ac87e090bb4853.zip |
fuse: initialize the flock flag in fuse_file on allocation
commit 68227c03cba84a24faf8a7277d2b1a03c8959c2c upstream.
Before the patch, the flock flag could remain uninitialized for the
lifespan of the fuse_file allocation. Unless set to true in
fuse_file_flock(), it would remain in an indeterminate state until read in
an if statement in fuse_release_common(). This could consequently lead to
taking an unexpected branch in the code.
The bug was discovered by a runtime instrumentation designed to detect use
of uninitialized memory in the kernel.
Signed-off-by: Mateusz Jurczyk <mjurczyk@google.com>
Fixes: 37fb3a30b462 ("fuse: fix flock")
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/fuse/file.c')
-rw-r--r-- | fs/fuse/file.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/fuse/file.c b/fs/fuse/file.c index 5ec5870e423a..996aa23c409e 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c @@ -46,7 +46,7 @@ struct fuse_file *fuse_file_alloc(struct fuse_conn *fc) { struct fuse_file *ff; - ff = kmalloc(sizeof(struct fuse_file), GFP_KERNEL); + ff = kzalloc(sizeof(struct fuse_file), GFP_KERNEL); if (unlikely(!ff)) return NULL; |