[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20210803154249.81251-1-colin.king@canonical.com>
Date: Tue, 3 Aug 2021 16:42:49 +0100
From: Colin King <colin.king@...onical.com>
To: Alasdair Kergon <agk@...hat.com>, dm-devel@...hat.com,
Tushar Sugandhi <tusharsu@...ux.microsoft.com>
Cc: kernel-janitors@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH][next] dm ima: Fix resource leaks on error return path
From: Colin Ian King <colin.king@...onical.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@...onical.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
Powered by blists - more mailing lists