Merge tag 'block-6.1-2022-11-18' of git://git.kernel.dk/linux
[linux-block.git] / block / blk.h
index a0c1d31a8fe79ebb3001a108add3ebd10af9acc4..a186ea20f39d8a50721a2e4c4b6bd86db6bd6a0d 100644 (file)
@@ -88,6 +88,13 @@ static inline bool biovec_phys_mergeable(struct request_queue *q,
        phys_addr_t addr1 = page_to_phys(vec1->bv_page) + vec1->bv_offset;
        phys_addr_t addr2 = page_to_phys(vec2->bv_page) + vec2->bv_offset;
 
+       /*
+        * Merging adjacent physical pages may not work correctly under KMSAN
+        * if their metadata pages aren't adjacent. Just disable merging.
+        */
+       if (IS_ENABLED(CONFIG_KMSAN))
+               return false;
+
        if (addr1 + vec1->bv_len != addr2)
                return false;
        if (xen_domain() && !xen_biovec_phys_mergeable(vec1, vec2->bv_page))