]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: setup qstr from dentrys using fscrypt helper
authorSweet Tea Dorminy <sweettea-kernel@dorminy.me>
Thu, 20 Oct 2022 16:58:26 +0000 (12:58 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 10 Oct 2023 20:00:36 +0000 (22:00 +0200)
commit68ad364ec8dd43f977dd58b28b4eb26f1826ddea
tree3f9c791c0350124271f678e13c92c1a2a90777b5
parent1cf474cd474bc5d3ef63086ffd009a87a5b7bb2e
btrfs: setup qstr from dentrys using fscrypt helper

[ Upstream commit ab3c5c18e8fa3f8ea116016095d25adab466cd39 ]

Most places where we get a struct qstr, we are doing so from a dentry.
With fscrypt, the dentry's name may be encrypted on-disk, so fscrypt
provides a helper to convert a dentry name to the appropriate disk name
if necessary. Convert each of the dentry name accesses to use
fscrypt_setup_filename(), then convert the resulting fscrypt_name back
to an unencrypted qstr. This does not work for nokey names, but the
specific locations that could spawn nokey names are noted.

At present, since there are no encrypted directories, nothing goes down
the filename encryption paths.

Signed-off-by: Sweet Tea Dorminy <sweettea-kernel@dorminy.me>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Stable-dep-of: 9af86694fd5d ("btrfs: file_remove_privs needs an exclusive lock in direct io write")
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/btrfs/ctree.h
fs/btrfs/inode.c
fs/btrfs/transaction.c
fs/btrfs/tree-log.c