From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C59F91F941 for ; Fri, 21 Jul 2023 16:17:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 488F9C433C8; Fri, 21 Jul 2023 16:17:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1689956257; bh=BSer5YVRj5WFIN0Jr+ULe4F37KEkn/xYkL3yeex9NmM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gMk27hH4BS5Uoimjrh5HWl4Tc/+8DrevZpnHqGIIFswAR36fwRhOYi72OJZjtCJzC xH9Hu7XwRE5TNTsCHQDoFKj0e7JV22Hm3O/MKdZSsLqnoBOeDhV8QSzYT//e7WhTuS BbkOeK2OTYA/IBghkYMiD/pEZ+Sre08SxlK6zTXk= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, stable@kernel.org, Chao Yu , Theodore Tso Subject: [PATCH 6.4 155/292] ext4: fix to check return value of freeze_bdev() in ext4_shutdown() Date: Fri, 21 Jul 2023 18:04:24 +0200 Message-ID: <20230721160535.560068243@linuxfoundation.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230721160528.800311148@linuxfoundation.org> References: <20230721160528.800311148@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Chao Yu commit c4d13222afd8a64bf11bc7ec68645496ee8b54b9 upstream. freeze_bdev() can fail due to a lot of reasons, it needs to check its reason before later process. Fixes: 783d94854499 ("ext4: add EXT4_IOC_GOINGDOWN ioctl") Cc: stable@kernel.org Signed-off-by: Chao Yu Link: https://lore.kernel.org/r/20230606073203.1310389-1-chao@kernel.org Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman --- fs/ext4/ioctl.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/fs/ext4/ioctl.c +++ b/fs/ext4/ioctl.c @@ -797,6 +797,7 @@ static int ext4_shutdown(struct super_bl { struct ext4_sb_info *sbi = EXT4_SB(sb); __u32 flags; + int ret; if (!capable(CAP_SYS_ADMIN)) return -EPERM; @@ -815,7 +816,9 @@ static int ext4_shutdown(struct super_bl switch (flags) { case EXT4_GOING_FLAGS_DEFAULT: - freeze_bdev(sb->s_bdev); + ret = freeze_bdev(sb->s_bdev); + if (ret) + return ret; set_bit(EXT4_FLAGS_SHUTDOWN, &sbi->s_ext4_flags); thaw_bdev(sb->s_bdev); break;