Skip to content

Commit 7271d13

Browse files
j00rugregkh
authored andcommitted
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: 37fb3a3 ("fuse: fix flock") Signed-off-by: Miklos Szeredi <mszeredi@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent b89e781 commit 7271d13

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

fs/fuse/file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ struct fuse_file *fuse_file_alloc(struct fuse_conn *fc)
4646
{
4747
struct fuse_file *ff;
4848

49-
ff = kmalloc(sizeof(struct fuse_file), GFP_KERNEL);
49+
ff = kzalloc(sizeof(struct fuse_file), GFP_KERNEL);
5050
if (unlikely(!ff))
5151
return NULL;
5252

0 commit comments

Comments
 (0)