Skip to content

fix: check get_path_nullok return value in fuse_lib_flush (issue #1188)#2

Open
ShukantPal wants to merge 2 commits intomasterfrom
fix/issue-1188
Open

fix: check get_path_nullok return value in fuse_lib_flush (issue #1188)#2
ShukantPal wants to merge 2 commits intomasterfrom
fix/issue-1188

Conversation

@ShukantPal
Copy link
Copy Markdown
Owner

fuse_lib_flush called get_path_nullok() but ignored the return value,
passing a potentially NULL path to fuse_flush_common(). When a directory
is concurrently removed or renamed, get_path_nullok() can fail and
return NULL, causing a crash in the flush callback.

Now check the return value and only proceed when the path lookup
succeeds, matching the pattern used by fuse_lib_read, fuse_lib_write_buf,
and fuse_lock_common.

…use#1188)

fuse_lib_flush called get_path_nullok() but ignored the return value,
passing a potentially NULL path to fuse_flush_common(). When a directory
is concurrently removed or renamed, get_path_nullok() can fail and
return NULL, causing a crash in the flush callback.

Now check the return value and only proceed when the path lookup
succeeds, matching the pattern used by fuse_lib_read, fuse_lib_write_buf,
and fuse_lock_common.
@bolt-new-by-stackblitz
Copy link
Copy Markdown

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

…e#1188)

Add test_flush_null_path to test/test_examples.py that exercises the
open-unlink-close code path which triggers FUSE_FLUSH on a file whose
path may not be resolvable.  The test mounts passthrough_fh, creates
files, unlinks them while fds are still open, then closes the fds
(triggering flush).  Both sequential and concurrent iterations are
performed to stress the multi-threaded flush path.

This regression test covers the fix in fuse_lib_flush() that checks
the return value of get_path_nullok() before calling fuse_flush_common().
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant