We always need to take a reference on the file system we are writing to. Signed-off-by: Christoph Hellwig <hch@xxxxxx> --- fs/read_write.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/read_write.c b/fs/read_write.c index bbfa9b12b15eb..d5aaf3a4198b9 100644 --- a/fs/read_write.c +++ b/fs/read_write.c @@ -508,6 +508,7 @@ ssize_t __kernel_write(struct file *file, const void *buf, size_t count, loff_t if (!(file->f_mode & FMODE_CAN_WRITE)) return -EINVAL; + file_start_write(file); old_fs = get_fs(); set_fs(KERNEL_DS); p = (__force const char __user *)buf; @@ -520,6 +521,7 @@ ssize_t __kernel_write(struct file *file, const void *buf, size_t count, loff_t add_wchar(current, ret); } inc_syscw(current); + file_end_write(file); return ret; } EXPORT_SYMBOL(__kernel_write); -- 2.26.2