Unverified Commit 53e8441b authored by Christian Brauner's avatar Christian Brauner
Browse files

Merge patch series "name_is_dot* cleanup"

Amir Goldstein <amir73il@gmail.com> says:

Following the syzbot ovl bug report and a fix by Qing Wang,
I decided to follow up with a small vfs cleanup of some
open coded version of checking "." and ".." name in readdir.

The fix patch is applied at the start of this cleanup series to allow
for easy backporting, but it is not an urgent fix so I don't think
there is a need to fast track it.

* patches from https://patch.msgid.link/20260128132406.23768-1-amir73il@gmail.com:
  ovl: use name_is_dot* helpers in readdir code
  fs: add helpers name_is_dot{,dot,_dotdot}
  ovl: Fix uninit-value in ovl_fill_real

Link: https://patch.msgid.link/20260128132406.23768-1-amir73il@gmail.com


Signed-off-by: default avatarChristian Brauner <brauner@kernel.org>
parents 9396bfda 9cf8ddb1
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -76,7 +76,7 @@ struct fscrypt_nokey_name {

static inline bool fscrypt_is_dot_dotdot(const struct qstr *str)
{
	return is_dot_dotdot(str->name, str->len);
	return name_is_dot_dotdot(str->name, str->len);
}

/**
+1 −1
Original line number Diff line number Diff line
@@ -1904,7 +1904,7 @@ int ecryptfs_decode_and_decrypt_filename(char **plaintext_name,

	if ((mount_crypt_stat->flags & ECRYPTFS_GLOBAL_ENCRYPT_FILENAMES) &&
	    !(mount_crypt_stat->flags & ECRYPTFS_ENCRYPTED_VIEW_ENABLED)) {
		if (is_dot_dotdot(name, name_size)) {
		if (name_is_dot_dotdot(name, name_size)) {
			rc = ecryptfs_copy_filename(plaintext_name,
						    plaintext_name_size,
						    name, name_size);
+2 −1
Original line number Diff line number Diff line
@@ -253,7 +253,8 @@ static bool filldir_one(struct dir_context *ctx, const char *name, int len,
		container_of(ctx, struct getdents_callback, ctx);

	buf->sequence++;
	if (buf->ino == ino && len <= NAME_MAX && !is_dot_dotdot(name, len)) {
	if (buf->ino == ino && len <= NAME_MAX &&
	    !name_is_dot_dotdot(name, len)) {
		memcpy(buf->name, name, len);
		buf->name[len] = '\0';
		buf->found = 1;
+1 −1
Original line number Diff line number Diff line
@@ -67,7 +67,7 @@ int f2fs_init_casefolded_name(const struct inode *dir,
	int len;

	if (IS_CASEFOLDED(dir) &&
	    !is_dot_dotdot(fname->usr_fname->name, fname->usr_fname->len)) {
	    !name_is_dot_dotdot(fname->usr_fname->name, fname->usr_fname->len)) {
		buf = f2fs_kmem_cache_alloc(f2fs_cf_name_slab,
					    GFP_NOFS, false, F2FS_SB(sb));
		if (!buf)
+1 −1
Original line number Diff line number Diff line
@@ -100,7 +100,7 @@ void f2fs_hash_filename(const struct inode *dir, struct f2fs_filename *fname)

	WARN_ON_ONCE(!name);

	if (is_dot_dotdot(name, len)) {
	if (name_is_dot_dotdot(name, len)) {
		fname->hash = 0;
		return;
	}
Loading