From: Dan Carpenter <dan.carpenter@oracle.com>
To: "Theodore Ts'o" <tytso@mit.edu>
Cc: Andreas Dilger <adilger.kernel@dilger.ca>,
linux-ext4@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [patch] ext4 crypto: unlock on error in ext4_set_encryption_metadata()
Date: Tue, 5 Jan 2016 12:57:19 +0300 [thread overview]
Message-ID: <20160105095719.GF23619@mwanda> (raw)
There is a missing unlock if ext4_journal_start() fails.
Fixes: 374431bae296 ('ext4 crypto: add ioctls to allow backup of encryption metadata')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/fs/ext4/crypto_key.c b/fs/ext4/crypto_key.c
index 6e6fbcb..21fdcea 100644
--- a/fs/ext4/crypto_key.c
+++ b/fs/ext4/crypto_key.c
@@ -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);
next reply other threads:[~2016-01-05 9:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-05 9:57 Dan Carpenter [this message]
2016-01-08 20:36 ` [patch] ext4 crypto: unlock on error in ext4_set_encryption_metadata() Theodore Ts'o
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160105095719.GF23619@mwanda \
--to=dan.carpenter@oracle.com \
--cc=adilger.kernel@dilger.ca \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-ext4@vger.kernel.org \
--cc=tytso@mit.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).