Linux filesystem development
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: Viacheslav Dubeyko <slava@dubeyko.com>
Cc: dhowells@redhat.com, ceph-devel@vger.kernel.org,
	amarkuze@redhat.com, idryomov@gmail.com,
	linux-fsdevel@vger.kernel.org, pdonnell@redhat.com,
	Slava.Dubeyko@ibm.com
Subject: Re: [PATCH v3] ceph: fix slab-use-after-free in have_mon_and_osd_map()
Date: Tue, 04 Mar 2025 08:56:57 +0000	[thread overview]
Message-ID: <3896161.1741078617@warthog.procyon.org.uk> (raw)
In-Reply-To: <20250303203137.42636-1-slava@dubeyko.com>

Viacheslav Dubeyko <slava@dubeyko.com> wrote:

> +	mutex_lock(&monc->mutex);
>  	kfree(monc->monmap);
> +	monc->monmap = NULL;
> +	mutex_unlock(&monc->mutex);

I would do the kfree after the locked region:

	mutex_lock(&monc->mutex);
	old_monmap = monc->monmap;
	monc->monmap = NULL;
	mutex_unlock(&monc->mutex);
	kfree(old_monmap);

David


  reply	other threads:[~2025-03-04  8:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-03 20:31 [PATCH v3] ceph: fix slab-use-after-free in have_mon_and_osd_map() Viacheslav Dubeyko
2025-03-04  8:56 ` David Howells [this message]
2025-03-04 18:21   ` Viacheslav Dubeyko

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=3896161.1741078617@warthog.procyon.org.uk \
    --to=dhowells@redhat.com \
    --cc=Slava.Dubeyko@ibm.com \
    --cc=amarkuze@redhat.com \
    --cc=ceph-devel@vger.kernel.org \
    --cc=idryomov@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=pdonnell@redhat.com \
    --cc=slava@dubeyko.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