mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: James Bottomley <James.Bottomley@HansenPartnership.com>
To: Breno Leitao <leitao@debian.org>, Ard Biesheuvel <ardb@kernel.org>
Cc: Jeremy Kerr <jk@ozlabs.org>,
	linux-efi@vger.kernel.org,  linux-kernel@vger.kernel.org,
	kernel-team@meta.com
Subject: Re: [PATCH] efivarfs: Suppress false-positive kmemleak warning for sfi
Date: Wed, 16 Jul 2025 09:09:00 -0400	[thread overview]
Message-ID: <7fe68ef138e43a5cf83c8b5d2dd3fc8101a8a225.camel@HansenPartnership.com> (raw)
In-Reply-To: <a3d063f4b0ccaad7595938ea0dca016872882f0d.camel@HansenPartnership.com>

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,


  reply	other threads:[~2025-07-16 13:09 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-15  9:28 Breno Leitao
2025-07-16  0:41 ` Ard Biesheuvel
2025-07-16 11:45   ` Breno Leitao
2025-07-16 12:31     ` James Bottomley
2025-07-16 13:09       ` James Bottomley [this message]
2025-07-16 13:16         ` Breno Leitao
2025-07-16 13:26           ` James Bottomley
2025-07-16 14:30             ` Breno Leitao

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=7fe68ef138e43a5cf83c8b5d2dd3fc8101a8a225.camel@HansenPartnership.com \
    --to=james.bottomley@hansenpartnership.com \
    --cc=ardb@kernel.org \
    --cc=jk@ozlabs.org \
    --cc=kernel-team@meta.com \
    --cc=leitao@debian.org \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®