diff options
| author | Zizhi Wo <[email protected]> | 2024-11-07 11:06:48 +0000 |
|---|---|---|
| committer | Christian Brauner <[email protected]> | 2024-11-11 13:39:38 +0000 |
| commit | 31ad74b20227ce6b40910ff78b1c604e42975cf1 (patch) | |
| tree | 36aab27035108a3eedddf92c30ce91a7e1674d00 /fs/ext4/fast_commit.c | |
| parent | cachefiles: Clean up in cachefiles_commit_tmpfile() (diff) | |
| download | kernel-31ad74b20227ce6b40910ff78b1c604e42975cf1.tar.gz kernel-31ad74b20227ce6b40910ff78b1c604e42975cf1.zip | |
cachefiles: Fix NULL pointer dereference in object->file
At present, the object->file has the NULL pointer dereference problem in
ondemand-mode. The root cause is that the allocated fd and object->file
lifetime are inconsistent, and the user-space invocation to anon_fd uses
object->file. Following is the process that triggers the issue:
[write fd] [umount]
cachefiles_ondemand_fd_write_iter
fscache_cookie_state_machine
cachefiles_withdraw_cookie
if (!file) return -ENOBUFS
cachefiles_clean_up_object
cachefiles_unmark_inode_in_use
fput(object->file)
object->file = NULL
// file NULL pointer dereference!
__cachefiles_write(..., file, ...)
Fix this issue by add an additional reference count to the object->file
before write/llseek, and decrement after it finished.
Fixes: c8383054506c ("cachefiles: notify the user daemon when looking up cookie")
Signed-off-by: Zizhi Wo <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Reviewed-by: David Howells <[email protected]>
Signed-off-by: Christian Brauner <[email protected]>
Diffstat (limited to 'fs/ext4/fast_commit.c')
0 files changed, 0 insertions, 0 deletions
