linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Theodore Y. Ts'o" <tytso@mit.edu>
To: "zhangyi (F)" <yi.zhang@huawei.com>
Cc: linux-ext4@vger.kernel.org, jack@suse.cz, adilger.kernel@dilger.ca
Subject: Re: [PATCH v5] ext4: fix potential use after free in system zone via remount with noblock_validity
Date: Sun, 25 Aug 2019 22:56:12 -0400	[thread overview]
Message-ID: <20190826025612.GB4918@mit.edu> (raw)
In-Reply-To: <20190825034000.GE5163@mit.edu>

I added a missing rcu_read_lock() to prevent a suspicious RCU
warning when CONFIG_PROVE_RCU is enabled:

diff --git a/fs/ext4/block_validity.c b/fs/ext4/block_validity.c
index 003dc1dc2da3..f7bc914a74df 100644
--- a/fs/ext4/block_validity.c
+++ b/fs/ext4/block_validity.c
@@ -330,11 +330,13 @@ void ext4_release_system_zone(struct super_block *sb)
 {
 	struct ext4_system_blocks *system_blks;
 
+	rcu_read_lock();
 	system_blks = rcu_dereference(EXT4_SB(sb)->system_blks);
 	rcu_assign_pointer(EXT4_SB(sb)->system_blks, NULL);
 
 	if (system_blks)
 		call_rcu(&system_blks->rcu, ext4_destroy_system_zone);
+	rcu_read_unlock();
 }
 
 int ext4_data_block_valid(struct ext4_sb_info *sbi, ext4_fsblk_t start_blk,


     				  	       	     - Ted

  parent reply	other threads:[~2019-08-26  2:56 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-15 11:47 [PATCH v5] ext4: fix potential use after free in system zone via remount with noblock_validity zhangyi (F)
2019-08-25  3:40 ` Theodore Y. Ts'o
2019-08-25 17:32   ` Eric Biggers
2019-08-26  2:56   ` Theodore Y. Ts'o [this message]
2019-08-26  8:31     ` zhangyi (F)
2019-08-26 15:03       ` Jan Kara
2019-08-27  9:20         ` zhangyi (F)

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=20190826025612.GB4918@mit.edu \
    --to=tytso@mit.edu \
    --cc=adilger.kernel@dilger.ca \
    --cc=jack@suse.cz \
    --cc=linux-ext4@vger.kernel.org \
    --cc=yi.zhang@huawei.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;
as well as URLs for NNTP newsgroup(s).