Skip to contentSkip to conversation

ext4 crypto: unlock on error in ext4_set_encryption_metadata()

PATCH In review Dan Carpenter 2 participants 2 messages Jan 5, 2016 – Jan 8, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ext4 crypto: unlock on error in ext4_set_encryption_metadata()

There is a missing unlock if ext4_journal_start() fails.

Fixes 374431bae296 ('ext4 crypto: add ioctls to allow backup of encryption metadata')
fs/ext4/crypto_key.c +4 -2
index 6e6fbcb..21fdcea 100644
@@ -372,8 +372,10 @@ int ext4_set_encryption_metadata(struct inode *inode,
 
 	handle = ext4_journal_start(inode, EXT4_HT_MISC,
 				    ext4_jbd2_credits_xattr(inode));
-	if (IS_ERR(handle))
-		return PTR_ERR(handle);
+	if (IS_ERR(handle)) {
+		res = PTR_ERR(handle);
+		goto errout;
+	}
 	res = ext4_xattr_set(inode, EXT4_XATTR_INDEX_ENCRYPTION,
 			     EXT4_XATTR_NAME_ENCRYPTION_CONTEXT, ctx,
 			     sizeof(struct ext4_encryption_context), 0);
maintainer
#1 lore raw
Quoted 4 lines · Dan Carpenter

There is a missing unlock if ext4_journal_start() fails.

Fixes 374431bae296 ('ext4 crypto: add ioctls to allow backup of encryption metadata')

Thanks for pointing this out! I've fixed this by folded this into the appropriate commit.

- Ted