summaryrefslogtreecommitdiff
path: root/drivers/md
diff options
context:
space:
mode:
authorTushar Sugandhi <tusharsu@linux.microsoft.com>2021-08-14 00:37:59 +0300
committerMike Snitzer <snitzer@redhat.com>2021-08-20 23:07:35 +0300
commitf1cd6cb24b6b3cd95227e8016d092310a4015e96 (patch)
treed9b72f7301b9b21ad7702244861783a21d9c84e5 /drivers/md
parent9c2adfa6ba134efaf0bdeb15f76f99e9bcffb903 (diff)
downloadlinux-f1cd6cb24b6b3cd95227e8016d092310a4015e96.tar.xz
dm ima: add a warning in dm_init if duplicate ima events are not measured
The end-users of DM devices/targets may remove and re-create the same device multiple times. IMA does not measure such duplicate events if the configuration CONFIG_IMA_DISABLE_HTABLE is set to 'n'. To avoid confusion, the end-users need some indication on the client if that configuration option is disabled. Add a one-time warning during dm_init() if CONFIG_IMA_DISABLE_HTABLE is set to 'n', to notify the end-users that duplicate events will not be measured in the ima log. Also cleanup some whitespace in dm_init(). Signed-off-by: Tushar Sugandhi <tusharsu@linux.microsoft.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/dm.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index 33e55ac9ec65..84e9145b1714 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -262,9 +262,13 @@ static void (*_exits[])(void) = {
static int __init dm_init(void)
{
const int count = ARRAY_SIZE(_inits);
-
int r, i;
+#if (IS_ENABLED(CONFIG_IMA) && !IS_ENABLED(CONFIG_IMA_DISABLE_HTABLE))
+ DMWARN("CONFIG_IMA_DISABLE_HTABLE is disabled."
+ " Duplicate IMA measurements will not be recorded in the IMA log.");
+#endif
+
for (i = 0; i < count; i++) {
r = _inits[i]();
if (r)
@@ -272,8 +276,7 @@ static int __init dm_init(void)
}
return 0;
-
- bad:
+bad:
while (i--)
_exits[i]();