From: Colin King <colin.king@canonical.com>
To: Alasdair Kergon <agk@redhat.com>,
dm-devel@redhat.com,
Tushar Sugandhi <tusharsu@linux.microsoft.com>
Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH][next] dm ima: Fix resource leaks on error return path
Date: Tue, 3 Aug 2021 16:42:49 +0100 [thread overview]
Message-ID: <20210803154249.81251-1-colin.king@canonical.com> (raw)
From: Colin Ian King <colin.king@canonical.com>
Currently there is an error check on r that immediately returns
on an error rather than taking the error clean-up exit path via
label 'error'. Fix this to avoid resource leaks.
Addresses-Coverity: ("Resourced leak")
Fixes: 0a3bec81a409 ("dm ima: measure data on table load")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
drivers/md/dm-ima.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/md/dm-ima.c b/drivers/md/dm-ima.c
index 2d796e439bee..91ea4a7202ab 100644
--- a/drivers/md/dm-ima.c
+++ b/drivers/md/dm-ima.c
@@ -216,7 +216,7 @@ void dm_ima_measure_on_table_load(struct dm_table *table, unsigned int status_fl
r = crypto_shash_init(shash);
if (r)
- return;
+ goto error;
device_data_buf_len = strlen(device_data_buf);
memcpy(ima_buf + l, device_data_buf, device_data_buf_len);
--
2.31.1
reply other threads:[~2021-08-03 15:42 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20210803154249.81251-1-colin.king@canonical.com \
--to=colin.king@canonical.com \
--cc=agk@redhat.com \
--cc=dm-devel@redhat.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tusharsu@linux.microsoft.com \
/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).