jfs: logmgr: use __bio_add_page to add single page to bio
[linux-block.git] / io_uring / rsrc.c
index d4c91393e0d34c5d8a3d47a68ee4303359509d98..d46f72a5ef732374a3f623e78ff636102490c673 100644 (file)
@@ -1116,7 +1116,12 @@ static int io_sqe_buffer_register(struct io_ring_ctx *ctx, struct iovec *iov,
        if (nr_pages > 1) {
                folio = page_folio(pages[0]);
                for (i = 1; i < nr_pages; i++) {
-                       if (page_folio(pages[i]) != folio) {
+                       /*
+                        * Pages must be consecutive and on the same folio for
+                        * this to work
+                        */
+                       if (page_folio(pages[i]) != folio ||
+                           pages[i] != pages[i - 1] + 1) {
                                folio = NULL;
                                break;
                        }