Messages in this thread Patch in this message | | | Date | Sun, 17 Aug 2003 17:40:54 +0100 (BST) | From | Mark Hemment <> | Subject | [PATCH] Wrong assumption in set_bh_page() |
| |
set_bh_page() assumes page_address() will always return NULL for a highmem page. This assumption is wrong - the highmem page could be kmap()ped.
Luckily, no code I've looked at assumes that b_data contains a _pure_ offset for a highmem page, but this is a bug waiting to happen.
Patch is against 2.4.21-rc1.
Mark
diff -urN linux-2.4.21-rc1/fs/buffer.c linux-2.4.21-rc1-bh/fs/buffer.c --- linux-2.4.21-rc1/fs/buffer.c 2003-08-17 15:55:40.000000000 +0100 +++ linux-2.4.21-rc1-bh/fs/buffer.c 2003-08-17 18:15:13.000000000 +0100 @@ -1231,10 +1231,11 @@ if (offset >= PAGE_SIZE) BUG();
- /* - * page_address will return NULL anyways for highmem pages - */ - bh->b_data = page_address(page) + offset; + if (PageHighMem(page)) { + bh->b_data = (char *)offset; + } else { + bh->b_data = page_address(page) + offset; + } bh->b_page = page; } EXPORT_SYMBOL(set_bh_page);
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |