diff options
| author | GuoHan Zhao <zhaoguohan@kylinos.cn> | 2026-05-10 22:54:37 +0800 |
|---|---|---|
| committer | Miklos Szeredi <mszeredi@redhat.com> | 2026-05-12 08:21:39 +0200 |
| commit | 040d71ac647099f7bb5e480fcd74ba68abc3cb18 (patch) | |
| tree | 5d8fd47755a10a6c83a513a38d0d568c239a422c /fs | |
| parent | 47f7aebb796b505e613ae881d476d1ba7059ab67 (diff) | |
| download | linux-next-history-040d71ac647099f7bb5e480fcd74ba68abc3cb18.tar.gz | |
fuse: use current creds for backing files
FUSE backing files only need a stable snapshot of the current credentials
for later backing-file I/O. prepare_creds() allocates a mutable copy and
can fail, but this code never modifies or commits the result.
Use get_current_cred() instead and store it as a const pointer. This
matches the rest of the backing-file helpers and avoids an unnecessary
allocation and failure path.
Signed-off-by: GuoHan Zhao <zhaoguohan@kylinos.cn>
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Acked-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Diffstat (limited to 'fs')
| -rw-r--r-- | fs/fuse/backing.c | 2 | ||||
| -rw-r--r-- | fs/fuse/fuse_i.h | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/fs/fuse/backing.c b/fs/fuse/backing.c index 3d3f49c2dd422..472b6afa7dfff 100644 --- a/fs/fuse/backing.c +++ b/fs/fuse/backing.c @@ -119,7 +119,7 @@ int fuse_backing_open(struct fuse_conn *fc, struct fuse_backing_map *map) goto out_fput; fb->file = file; - fb->cred = prepare_creds(); + fb->cred = get_current_cred(); refcount_set(&fb->count, 1); res = fuse_backing_id_alloc(fc, fb); diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h index 3a7ac74a23ed6..55a3841b28899 100644 --- a/fs/fuse/fuse_i.h +++ b/fs/fuse/fuse_i.h @@ -91,7 +91,7 @@ struct fuse_submount_lookup { /* Container for data related to mapping to backing file */ struct fuse_backing { struct file *file; - struct cred *cred; + const struct cred *cred; /* refcount */ refcount_t count; |
