Skip to content

Commit 782598e

Browse files
committed
Merge tag 'zonefs-5.10-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/dlemoal/zonefs
Pull zonefs fix from Damien Le Moal: "A single patch in this pull request to fix a BIO and page reference leak when writing sequential zone files" * tag 'zonefs-5.10-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/dlemoal/zonefs: zonefs: fix page reference and BIO leak
2 parents b7906b7 + 6bea022 commit 782598e

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

fs/zonefs/super.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -691,21 +691,23 @@ static ssize_t zonefs_file_dio_append(struct kiocb *iocb, struct iov_iter *from)
691691
bio->bi_opf |= REQ_FUA;
692692

693693
ret = bio_iov_iter_get_pages(bio, from);
694-
if (unlikely(ret)) {
695-
bio_io_error(bio);
696-
return ret;
697-
}
694+
if (unlikely(ret))
695+
goto out_release;
696+
698697
size = bio->bi_iter.bi_size;
699-
task_io_account_write(ret);
698+
task_io_account_write(size);
700699

701700
if (iocb->ki_flags & IOCB_HIPRI)
702701
bio_set_polled(bio, iocb);
703702

704703
ret = submit_bio_wait(bio);
705704

705+
zonefs_file_write_dio_end_io(iocb, size, ret, 0);
706+
707+
out_release:
708+
bio_release_pages(bio, false);
706709
bio_put(bio);
707710

708-
zonefs_file_write_dio_end_io(iocb, size, ret, 0);
709711
if (ret >= 0) {
710712
iocb->ki_pos += size;
711713
return size;

0 commit comments

Comments
 (0)