bcachefs: Initialize bch_write_op->failed in inline data path
authorKent Overstreet <kent.overstreet@linux.dev>
Sat, 4 May 2024 16:29:46 +0000 (12:29 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Mon, 6 May 2024 14:58:17 +0000 (10:58 -0400)
Normally this is initialized in __bch2_write(), which is executed in a
loop, but the inline data path skips this.

Reported-by: syzbot+fd3ccb331eb21f05d13b@syzkaller.appspotmail.com
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/io_write.c

index b72cf31f72743c553c9f646f308986b93047ab64..40d7df7607dfd1a3b51be283c7791ec7f70d93a6 100644 (file)
@@ -1513,6 +1513,8 @@ static void bch2_write_data_inline(struct bch_write_op *op, unsigned data_len)
        unsigned sectors;
        int ret;
 
+       memset(&op->failed, 0, sizeof(op->failed));
+
        op->flags |= BCH_WRITE_WROTE_DATA_INLINE;
        op->flags |= BCH_WRITE_DONE;