linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christian Brauner <brauner@kernel.org>
To: Jan Kara <jack@suse.cz>, Christoph Hellwig <hch@lst.de>
Cc: linux-fsdevel@vger.kernel.org, Christian Brauner <brauner@kernel.org>
Subject: [PATCH 1/2] super: move lockdep assert
Date: Mon, 28 Aug 2023 13:26:23 +0200	[thread overview]
Message-ID: <20230828-vfs-super-fixes-v1-1-b37a4a04a88f@kernel.org> (raw)
In-Reply-To: <20230828-vfs-super-fixes-v1-0-b37a4a04a88f@kernel.org>

Fix braino and move the lockdep assertion after put_super() otherwise we
risk a use-after-free.

Fixes: 2c18a63b760a ("super: wait until we passed kill super")
Signed-off-by: Christian Brauner <brauner@kernel.org>
---
 fs/super.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/super.c b/fs/super.c
index ef87103e2a51..779247eb219c 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -570,8 +570,8 @@ static bool grab_super_dead(struct super_block *sb)
 		return true;
 	}
 	wait_var_event(&sb->s_flags, wait_dead(sb));
-	put_super(sb);
 	lockdep_assert_not_held(&sb->s_umount);
+	put_super(sb);
 	return false;
 }
 

-- 
2.34.1


  reply	other threads:[~2023-08-28 11:27 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-28 11:26 [PATCH 0/2] Small follow-up fixes for this cycle Christian Brauner
2023-08-28 11:26 ` Christian Brauner [this message]
2023-08-28 11:55   ` [PATCH 1/2] super: move lockdep assert Jan Kara
2023-08-28 12:01   ` Christoph Hellwig
2023-08-28 11:26 ` [PATCH 2/2] super: ensure valid info Christian Brauner
2023-08-28 12:04   ` Christoph Hellwig
2023-08-28 12:28     ` Christian Brauner
2023-08-28 14:03       ` Christoph Hellwig
2023-08-28 13:07   ` Jan Kara
2023-08-28 13:17     ` Christian Brauner
2023-08-29  8:15 ` [PATCH 0/2] Small follow-up fixes for this cycle Christian Brauner

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=20230828-vfs-super-fixes-v1-1-b37a4a04a88f@kernel.org \
    --to=brauner@kernel.org \
    --cc=hch@lst.de \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@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;
as well as URLs for NNTP newsgroup(s).