Skip to content

Commit

Permalink
fuse: initialize the flock flag in fuse_file on allocation
Browse files Browse the repository at this point in the history
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 <[email protected]>
Fixes: 37fb3a30b462 ("fuse: fix flock")
Cc: <[email protected]> # v3.1+
Signed-off-by: Miklos Szeredi <[email protected]>
Signed-off-by: Willy Tarreau <[email protected]>
  • Loading branch information
j00ru authored and MagnusAlm committed Mar 24, 2019
1 parent 9cb88f9 commit af0ccdc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/fuse/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,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;

Expand Down

0 comments on commit af0ccdc

Please sign in to comment.