Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit db4247d1 authored by Eric Biggers's avatar Eric Biggers Committed by Jaegeuk Kim
Browse files

fscrypt: remove 'ci' parameter from fscrypt_put_encryption_info()



fscrypt_put_encryption_info() is only called when evicting an inode, so
the 'struct fscrypt_info *ci' parameter is always NULL, and there cannot
be races with other threads.  This was cruft left over from the broken
key revocation code.  Remove the unused parameter and the cmpxchg().

Also remove the #ifdefs around the fscrypt_put_encryption_info() calls,
since fscrypt_notsupp.h defines a no-op stub for it.

Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
parent 29127d39
Loading
Loading
Loading
Loading
+3 −13
Original line number Diff line number Diff line
@@ -367,19 +367,9 @@ out:
}
EXPORT_SYMBOL(fscrypt_get_encryption_info);

void fscrypt_put_encryption_info(struct inode *inode, struct fscrypt_info *ci)
void fscrypt_put_encryption_info(struct inode *inode)
{
	struct fscrypt_info *prev;

	if (ci == NULL)
		ci = ACCESS_ONCE(inode->i_crypt_info);
	if (ci == NULL)
		return;

	prev = cmpxchg(&inode->i_crypt_info, ci, NULL);
	if (prev != ci)
		return;

	put_crypt_info(ci);
	put_crypt_info(inode->i_crypt_info);
	inode->i_crypt_info = NULL;
}
EXPORT_SYMBOL(fscrypt_put_encryption_info);
+1 −1
Original line number Diff line number Diff line
@@ -585,7 +585,7 @@ no_delete:
			!exist_written_data(sbi, inode->i_ino, ORPHAN_INO));
	}
out_clear:
	fscrypt_put_encryption_info(inode, NULL);
	fscrypt_put_encryption_info(inode);
	clear_inode(inode);
}

+1 −2
Original line number Diff line number Diff line
@@ -104,8 +104,7 @@ static inline int fscrypt_get_encryption_info(struct inode *inode)
	return -EOPNOTSUPP;
}

static inline void fscrypt_put_encryption_info(struct inode *inode,
					       struct fscrypt_info *ci)
static inline void fscrypt_put_encryption_info(struct inode *inode)
{
	return;
}
+1 −1
Original line number Diff line number Diff line
@@ -95,7 +95,7 @@ extern int fscrypt_inherit_context(struct inode *, struct inode *,
					void *, bool);
/* keyinfo.c */
extern int fscrypt_get_encryption_info(struct inode *);
extern void fscrypt_put_encryption_info(struct inode *, struct fscrypt_info *);
extern void fscrypt_put_encryption_info(struct inode *);

/* fname.c */
extern int fscrypt_setup_filename(struct inode *, const struct qstr *,