[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7fe68ef138e43a5cf83c8b5d2dd3fc8101a8a225.camel@HansenPartnership.com>
Date: Wed, 16 Jul 2025 09:09:00 -0400
From: James Bottomley <James.Bottomley@...senPartnership.com>
To: Breno Leitao <leitao@...ian.org>, Ard Biesheuvel <ardb@...nel.org>
Cc: Jeremy Kerr <jk@...abs.org>, linux-efi@...r.kernel.org,
linux-kernel@...r.kernel.org, kernel-team@...a.com
Subject: Re: [PATCH] efivarfs: Suppress false-positive kmemleak warning for
sfi
On Wed, 2025-07-16 at 08:31 -0400, James Bottomley wrote:
[...]
> If the theory is correct, the leak is genuine and we need to
> implement .free in efivarfs_context_ops to fix it.
Rather than trying to trace this, which will be hard, it might be
easier just to try the fix below (not even compile tested) and see if
it works. Note there's no danger of a double free because when fc-
>s_fs_info is copied to sb->s_fs_info, the field is nulled in fc.
Regards,
James
---
diff --git a/fs/efivarfs/super.c b/fs/efivarfs/super.c
index c900d98bf494..90a619d027fd 100644
--- a/fs/efivarfs/super.c
+++ b/fs/efivarfs/super.c
@@ -390,10 +390,16 @@ static int efivarfs_reconfigure(struct fs_context *fc)
return 0;
}
+static void efivarfs_fs_context_free(struct fs_context *fc)
+{
+ kfree(fc->s_fs_info);
+}
+
static const struct fs_context_operations efivarfs_context_ops = {
.get_tree = efivarfs_get_tree,
.parse_param = efivarfs_parse_param,
.reconfigure = efivarfs_reconfigure,
+ .free = efivarfs_fs_context_free,
};
static int efivarfs_check_missing(efi_char16_t *name16, efi_guid_t vendor,
Powered by blists - more mailing lists