Skip to content

Commit fee4c19

Browse files
fdmananakdave
authored andcommitted
btrfs: fix fscrypt name leak after failure to join log transaction
When logging a new name, we don't expect to fail joining a log transaction since we know at least one of the inodes was logged before in the current transaction. However if we fail for some unexpected reason, we end up not freeing the fscrypt name we previously allocated. So fix that by freeing the name in case we failed to join a log transaction. Fixes: ab3c5c1 ("btrfs: setup qstr from dentrys using fscrypt helper") Reviewed-by: Sweet Tea Dorminy <[email protected]> Signed-off-by: Filipe Manana <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent e7fc357 commit fee4c19

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

fs/btrfs/tree-log.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7459,8 +7459,11 @@ void btrfs_log_new_name(struct btrfs_trans_handle *trans,
74597459
* not fail, but if it does, it's not serious, just bail out and
74607460
* mark the log for a full commit.
74617461
*/
7462-
if (WARN_ON_ONCE(ret < 0))
7462+
if (WARN_ON_ONCE(ret < 0)) {
7463+
fscrypt_free_filename(&fname);
74637464
goto out;
7465+
}
7466+
74647467
log_pinned = true;
74657468

74667469
path = btrfs_alloc_path();

0 commit comments

Comments
 (0)