mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-09-18 23:09:29 +02:00
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>
This commit is contained in:
committed by
Miklos Szeredi
parent
9107a3d8bb
commit
c51248524a
+1
-1
@@ -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);
|
||||
|
||||
+1
-1
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user