public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: <fan.yu9@zte.com.cn>
To: <richard@nod.at>, <chengzhihao1@huawei.com>
Cc: <cui.jinpeng2@zte.com.cn>, <zhang.yue5@zte.com.cn>,
	<xu.xin16@zte.com.cn>, <yang.tao172@zte.com.cn>,
	<yang.yang29@zte.com.cn>, <hu.shengming@zte.com.cn>,
	<linux-mtd@lists.infradead.org>, <linux-kernel@vger.kernel.org>
Subject: [PATCH v2] ubifs: prevent corrupted data write via error_remove_folio 
Date: Wed, 11 Feb 2026 22:15:29 +0800 (CST)	[thread overview]
Message-ID: <20260211221529715WQDbX2CWifJrBOSLR_8XF@zte.com.cn> (raw)

From: Jinpeng Cui <cui.jinpeng2@zte.com.cn>

When a memory corruption event triggers memory_failure, ext4 releases
references to the affected dirty pages, ensuring that no corrupted data
is written to disk.

However, ubifs currently lacks the error_remove_folio capabilityand
therefore cannot release references to faulty private memory. As a result,
corrupted data may eventually be written to flash storage.

Add generic_error_remove_folio support to ubifs,
preventing corrupted memory data from being persisted to flash.

Signed-off-by: Jinpeng Cui <cui.jinpeng2@zte.com.cn>
Signed-off-by: Shengming Hu <hu.shengming@zte.com.cn>
Signed-off-by: Fan Yu <fan.yu9@zte.com.cn>
Reviewed-by: Zhihao Cheng <chengzhihao1@huawei.com>
---
Changes in v2:
- Some format fixes according to
https://lore.kernel.org/all/20260211173233604W9pVxv17lV3V2uYD3zCOq@zte.com.cn/

 fs/ubifs/file.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c
index ca41ce8208c4..730318eb1ba8 100644
--- a/fs/ubifs/file.c
+++ b/fs/ubifs/file.c
@@ -1635,6 +1635,7 @@ const struct address_space_operations ubifs_file_address_operations = {
 	.dirty_folio	= ubifs_dirty_folio,
 	.migrate_folio	= filemap_migrate_folio,
 	.release_folio	= ubifs_release_folio,
+	.error_remove_folio = generic_error_remove_folio,
 };

 const struct inode_operations ubifs_file_inode_operations = {
-- 
2.25.1

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

                 reply	other threads:[~2026-02-11 14:15 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20260211221529715WQDbX2CWifJrBOSLR_8XF@zte.com.cn \
    --to=fan.yu9@zte.com.cn \
    --cc=chengzhihao1@huawei.com \
    --cc=cui.jinpeng2@zte.com.cn \
    --cc=hu.shengming@zte.com.cn \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=richard@nod.at \
    --cc=xu.xin16@zte.com.cn \
    --cc=yang.tao172@zte.com.cn \
    --cc=yang.yang29@zte.com.cn \
    --cc=zhang.yue5@zte.com.cn \
    /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