* [PATCH v2] fs: Remove redundant errseq_set call in mark_buffer_write_io_error.
@ 2025-05-07 12:30 Jeremy Bongio
2025-05-08 5:02 ` Christoph Hellwig
0 siblings, 1 reply; 4+ messages in thread
From: Jeremy Bongio @ 2025-05-07 12:30 UTC (permalink / raw)
To: Christoph Hellwig, Alexander Viro, Christian Brauner
Cc: linux-fsdevel, Jeremy Bongio
mark_buffer_write_io_error sets sb->s_wb_err to -EIO twice.
Once in mapping_set_error and once in errseq_set.
Only mapping_set_error checks if bh->b_assoc_map->host is NULL.
Discovered during null pointer dereference during writeback
to a failing device:
[<ffffffff9a416dc8>] ? mark_buffer_write_io_error+0x98/0xc0
[<ffffffff9a416dbe>] ? mark_buffer_write_io_error+0x8e/0xc0
[<ffffffff9ad4bda0>] end_buffer_async_write+0x90/0xd0
[<ffffffff9ad4e3eb>] end_bio_bh_io_sync+0x2b/0x40
[<ffffffff9adbafe6>] blk_update_request+0x1b6/0x480
[<ffffffff9adbb3d8>] blk_mq_end_request+0x18/0x30
[<ffffffff9adbc6aa>] blk_mq_dispatch_rq_list+0x4da/0x8e0
[<ffffffff9adc0a68>] __blk_mq_sched_dispatch_requests+0x218/0x6a0
[<ffffffff9adc07fa>] blk_mq_sched_dispatch_requests+0x3a/0x80
[<ffffffff9adbbb98>] blk_mq_run_hw_queue+0x108/0x330
[<ffffffff9adbcf58>] blk_mq_flush_plug_list+0x178/0x5f0
[<ffffffff9adb6741>] __blk_flush_plug+0x41/0x120
[<ffffffff9adb6852>] blk_finish_plug+0x22/0x40
[<ffffffff9ad47cb0>] wb_writeback+0x150/0x280
[<ffffffff9ac5343f>] ? set_worker_desc+0x9f/0xc0
[<ffffffff9ad4676e>] wb_workfn+0x24e/0x4a0
Fixes: 485e9605c0573 ("fs/buffer.c: record blockdev write errors in super_block that it backs")
Signed-off-by: Jeremy Bongio <jbongio@google.com>
---
Changes in v2:
- Removed brackets
- Corrected Fixed SHA
- Changed backtrace to a more relevant failure path.
---
fs/buffer.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/fs/buffer.c b/fs/buffer.c
index 7be23ff20b27..7ba1807145aa 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -1220,10 +1220,8 @@ void mark_buffer_write_io_error(struct buffer_head *bh)
/* FIXME: do we need to set this in both places? */
if (bh->b_folio && bh->b_folio->mapping)
mapping_set_error(bh->b_folio->mapping, -EIO);
- if (bh->b_assoc_map) {
+ if (bh->b_assoc_map)
mapping_set_error(bh->b_assoc_map, -EIO);
- errseq_set(&bh->b_assoc_map->host->i_sb->s_wb_err, -EIO);
- }
}
EXPORT_SYMBOL(mark_buffer_write_io_error);
--
2.49.0.967.g6a0df3ecc3-goog
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2] fs: Remove redundant errseq_set call in mark_buffer_write_io_error.
2025-05-07 12:30 [PATCH v2] fs: Remove redundant errseq_set call in mark_buffer_write_io_error Jeremy Bongio
@ 2025-05-08 5:02 ` Christoph Hellwig
2025-05-13 18:36 ` Jeremy Bongio
0 siblings, 1 reply; 4+ messages in thread
From: Christoph Hellwig @ 2025-05-08 5:02 UTC (permalink / raw)
To: Jeremy Bongio
Cc: Christoph Hellwig, Alexander Viro, Christian Brauner,
linux-fsdevel
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] fs: Remove redundant errseq_set call in mark_buffer_write_io_error.
2025-05-08 5:02 ` Christoph Hellwig
@ 2025-05-13 18:36 ` Jeremy Bongio
2025-05-15 9:09 ` Christian Brauner
0 siblings, 1 reply; 4+ messages in thread
From: Jeremy Bongio @ 2025-05-13 18:36 UTC (permalink / raw)
To: Christian Brauner; +Cc: Christoph Hellwig, Alexander Viro, linux-fsdevel
Hi Christian,
Friendly ping. Can you take this bug fix?
On Wed, May 7, 2025 at 10:02 PM Christoph Hellwig <hch@lst.de> wrote:
>
> Looks good:
>
> Reviewed-by: Christoph Hellwig <hch@lst.de>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] fs: Remove redundant errseq_set call in mark_buffer_write_io_error.
2025-05-13 18:36 ` Jeremy Bongio
@ 2025-05-15 9:09 ` Christian Brauner
0 siblings, 0 replies; 4+ messages in thread
From: Christian Brauner @ 2025-05-15 9:09 UTC (permalink / raw)
To: Jeremy Bongio; +Cc: Christoph Hellwig, Alexander Viro, linux-fsdevel
On Tue, May 13, 2025 at 11:36:35AM -0700, Jeremy Bongio wrote:
> Hi Christian,
>
> Friendly ping. Can you take this bug fix?
Hey! This is already upstream. Thanks!
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-05-15 9:09 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-07 12:30 [PATCH v2] fs: Remove redundant errseq_set call in mark_buffer_write_io_error Jeremy Bongio
2025-05-08 5:02 ` Christoph Hellwig
2025-05-13 18:36 ` Jeremy Bongio
2025-05-15 9:09 ` Christian Brauner
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).