From c4ac8b424866f976d6c252cf178b1c81b193e752 Mon Sep 17 00:00:00 2001 From: Daniel Rosenberg Date: Mon, 7 Feb 2022 18:02:17 -0800 Subject: [PATCH] ANDROID: fuse-bpf: fix fuse_create_open_finalize If we hit an error during fuse_create_open, some variables will be undefined during the finalize, so check that they were actually initialized before accessing. Bug: 217570523 Test: attempt to over fill disk Signed-off-by: Daniel Rosenberg Change-Id: I094564b83e49eec2a6bac5bd050b4f7327b0c979 --- fs/fuse/backing.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fs/fuse/backing.c b/fs/fuse/backing.c index 8da15a080c8f..ae4eb9d66781 100644 --- a/fs/fuse/backing.c +++ b/fs/fuse/backing.c @@ -339,8 +339,10 @@ void *fuse_create_open_finalize( struct fuse_entry_out *feo = fa->out_args[0].value; struct fuse_open_out *foo = fa->out_args[1].value; - fi->nodeid = feo->nodeid; - ff->fh = foo->fh; + if (fi) + fi->nodeid = feo->nodeid; + if (ff) + ff->fh = foo->fh; return 0; }