Commit 81a07073 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] Don't swap to files which do not implement readpage

From: Zwane Mwaikambo <zwane@arm.linux.org.uk>

The swapon code uses read_cache_page() to access the swap header, so the
filesystem had better implement it.
parent ab642d48
...@@ -1318,6 +1318,10 @@ asmlinkage long sys_swapon(const char __user * specialfile, int swap_flags) ...@@ -1318,6 +1318,10 @@ asmlinkage long sys_swapon(const char __user * specialfile, int swap_flags)
/* /*
* Read the swap header. * Read the swap header.
*/ */
if (!mapping->a_ops->readpage) {
error = -EINVAL;
goto bad_swap;
}
page = read_cache_page(mapping, 0, page = read_cache_page(mapping, 0,
(filler_t *)mapping->a_ops->readpage, swap_file); (filler_t *)mapping->a_ops->readpage, swap_file);
if (IS_ERR(page)) { if (IS_ERR(page)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment