74 lines
2.6 KiB
Diff
74 lines
2.6 KiB
Diff
From 7adb9b7eb6c32cc5b7cea983ed187cf3f4122cf5 Mon Sep 17 00:00:00 2001
|
|
From: Ondrej Mosnacek <omosnace@redhat.com>
|
|
Date: Wed, 3 Jun 2026 10:49:48 +0200
|
|
Subject: [PATCH] cachefiles: use kiocb_{start,end}_write() helpers
|
|
|
|
JIRA: https://issues.redhat.com/browse/RHEL-179443
|
|
CVE: CVE-2026-46054
|
|
|
|
commit e6fa4c728fb671765291cca3a905986612c06b6e
|
|
Author: Amir Goldstein <amir73il@gmail.com>
|
|
Date: Thu Aug 17 17:13:37 2023 +0300
|
|
|
|
cachefiles: use kiocb_{start,end}_write() helpers
|
|
|
|
Use helpers instead of the open coded dance to silence lockdep warnings.
|
|
|
|
Suggested-by: Jan Kara <jack@suse.cz>
|
|
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
|
|
Reviewed-by: Jan Kara <jack@suse.cz>
|
|
Reviewed-by: Jens Axboe <axboe@kernel.dk>
|
|
Message-Id: <20230817141337.1025891-8-amir73il@gmail.com>
|
|
Signed-off-by: Christian Brauner <brauner@kernel.org>
|
|
|
|
Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
|
|
|
|
diff --git a/fs/cachefiles/io.c b/fs/cachefiles/io.c
|
|
index 175a25fcade8..009d23cd435b 100644
|
|
--- a/fs/cachefiles/io.c
|
|
+++ b/fs/cachefiles/io.c
|
|
@@ -259,9 +259,7 @@ static void cachefiles_write_complete(struct kiocb *iocb, long ret)
|
|
|
|
_enter("%ld", ret);
|
|
|
|
- /* Tell lockdep we inherited freeze protection from submission thread */
|
|
- __sb_writers_acquired(inode->i_sb, SB_FREEZE_WRITE);
|
|
- __sb_end_write(inode->i_sb, SB_FREEZE_WRITE);
|
|
+ kiocb_end_write(iocb);
|
|
|
|
if (ret < 0)
|
|
trace_cachefiles_io_error(object, inode, ret,
|
|
@@ -286,7 +284,6 @@ int __cachefiles_write(struct cachefiles_object *object,
|
|
{
|
|
struct cachefiles_cache *cache;
|
|
struct cachefiles_kiocb *ki;
|
|
- struct inode *inode;
|
|
unsigned int old_nofs;
|
|
ssize_t ret;
|
|
size_t len = iov_iter_count(iter);
|
|
@@ -322,19 +319,12 @@ int __cachefiles_write(struct cachefiles_object *object,
|
|
ki->iocb.ki_complete = cachefiles_write_complete;
|
|
atomic_long_add(ki->b_writing, &cache->b_writing);
|
|
|
|
- /* Open-code file_start_write here to grab freeze protection, which
|
|
- * will be released by another thread in aio_complete_rw(). Fool
|
|
- * lockdep by telling it the lock got released so that it doesn't
|
|
- * complain about the held lock when we return to userspace.
|
|
- */
|
|
- inode = file_inode(file);
|
|
- __sb_start_write(inode->i_sb, SB_FREEZE_WRITE);
|
|
- __sb_writers_release(inode->i_sb, SB_FREEZE_WRITE);
|
|
+ kiocb_start_write(&ki->iocb);
|
|
|
|
get_file(ki->iocb.ki_filp);
|
|
cachefiles_grab_object(object, cachefiles_obj_get_ioreq);
|
|
|
|
- trace_cachefiles_write(object, inode, ki->iocb.ki_pos, len);
|
|
+ trace_cachefiles_write(object, file_inode(file), ki->iocb.ki_pos, len);
|
|
old_nofs = memalloc_nofs_save();
|
|
ret = cachefiles_inject_write_error();
|
|
if (ret == 0)
|
|
--
|
|
2.50.1 (Apple Git-155)
|
|
|