summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMateusz Jurczyk <mjurczyk@google.com>2017-06-07 12:26:49 +0200
committerSasha Levin <alexander.levin@verizon.com>2017-09-10 16:36:10 -0400
commit8c0887766aeb78a954c2c695459cbe1a011de3f6 (patch)
tree05114921871fbe75464e2e964e99377f8168165a
parent8c4380284ef6ec19e4fcd2071f49ba07cf863966 (diff)
fuse: initialize the flock flag in fuse_file on allocation
[ Upstream commit 68227c03cba84a24faf8a7277d2b1a03c8959c2c ] 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") Cc: <stable@vger.kernel.org> # v3.1+ Signed-off-by: Miklos Szeredi <mszeredi@redhat.com> Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
-rw-r--r--fs/fuse/file.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 1f03f0a36e35..cacf95ac49fe 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;