Commit 2887fc5a authored by Gerald Schaefer's avatar Gerald Schaefer Committed by Martin Schwidefsky

[S390] Dont check for pfn_valid() in uaccess_pt.c

pfn_valid() actually checks for a valid struct page and not for a
valid pfn. Using xip mappings w/o struct pages, this will result in
-EFAULT returned by the (page table walk) user copy functions,
even though there is valid memory. Those user copy functions don't
need a struct page, so this patch just removes the pfn_valid() check.
Signed-off-by: default avatarGerald Schaefer <gerald.schaefer@de.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent cf087343
...@@ -119,8 +119,6 @@ static size_t __user_copy_pt(unsigned long uaddr, void *kptr, ...@@ -119,8 +119,6 @@ static size_t __user_copy_pt(unsigned long uaddr, void *kptr,
goto fault; goto fault;
pfn = pte_pfn(*pte); pfn = pte_pfn(*pte);
if (!pfn_valid(pfn))
goto out;
offset = uaddr & (PAGE_SIZE - 1); offset = uaddr & (PAGE_SIZE - 1);
size = min(n - done, PAGE_SIZE - offset); size = min(n - done, PAGE_SIZE - offset);
...@@ -135,7 +133,6 @@ static size_t __user_copy_pt(unsigned long uaddr, void *kptr, ...@@ -135,7 +133,6 @@ static size_t __user_copy_pt(unsigned long uaddr, void *kptr,
done += size; done += size;
uaddr += size; uaddr += size;
} while (done < n); } while (done < n);
out:
spin_unlock(&mm->page_table_lock); spin_unlock(&mm->page_table_lock);
return n - done; return n - done;
fault: fault:
...@@ -163,9 +160,6 @@ static unsigned long __dat_user_addr(unsigned long uaddr) ...@@ -163,9 +160,6 @@ static unsigned long __dat_user_addr(unsigned long uaddr)
goto fault; goto fault;
pfn = pte_pfn(*pte); pfn = pte_pfn(*pte);
if (!pfn_valid(pfn))
goto out;
ret = (pfn << PAGE_SHIFT) + (uaddr & (PAGE_SIZE - 1)); ret = (pfn << PAGE_SHIFT) + (uaddr & (PAGE_SIZE - 1));
out: out:
return ret; return ret;
...@@ -244,11 +238,6 @@ static size_t strnlen_user_pt(size_t count, const char __user *src) ...@@ -244,11 +238,6 @@ static size_t strnlen_user_pt(size_t count, const char __user *src)
goto fault; goto fault;
pfn = pte_pfn(*pte); pfn = pte_pfn(*pte);
if (!pfn_valid(pfn)) {
done = -1;
goto out;
}
offset = uaddr & (PAGE_SIZE-1); offset = uaddr & (PAGE_SIZE-1);
addr = (char *)(pfn << PAGE_SHIFT) + offset; addr = (char *)(pfn << PAGE_SHIFT) + offset;
len = min(count - done, PAGE_SIZE - offset); len = min(count - done, PAGE_SIZE - offset);
...@@ -256,7 +245,6 @@ static size_t strnlen_user_pt(size_t count, const char __user *src) ...@@ -256,7 +245,6 @@ static size_t strnlen_user_pt(size_t count, const char __user *src)
done += len_str; done += len_str;
uaddr += len_str; uaddr += len_str;
} while ((len_str == len) && (done < count)); } while ((len_str == len) && (done < count));
out:
spin_unlock(&mm->page_table_lock); spin_unlock(&mm->page_table_lock);
return done + 1; return done + 1;
fault: fault:
...@@ -325,12 +313,7 @@ static size_t copy_in_user_pt(size_t n, void __user *to, ...@@ -325,12 +313,7 @@ static size_t copy_in_user_pt(size_t n, void __user *to,
} }
pfn_from = pte_pfn(*pte_from); pfn_from = pte_pfn(*pte_from);
if (!pfn_valid(pfn_from))
goto out;
pfn_to = pte_pfn(*pte_to); pfn_to = pte_pfn(*pte_to);
if (!pfn_valid(pfn_to))
goto out;
offset_from = uaddr_from & (PAGE_SIZE-1); offset_from = uaddr_from & (PAGE_SIZE-1);
offset_to = uaddr_from & (PAGE_SIZE-1); offset_to = uaddr_from & (PAGE_SIZE-1);
offset_max = max(offset_from, offset_to); offset_max = max(offset_from, offset_to);
...@@ -342,7 +325,6 @@ static size_t copy_in_user_pt(size_t n, void __user *to, ...@@ -342,7 +325,6 @@ static size_t copy_in_user_pt(size_t n, void __user *to,
uaddr_from += size; uaddr_from += size;
uaddr_to += size; uaddr_to += size;
} while (done < n); } while (done < n);
out:
spin_unlock(&mm->page_table_lock); spin_unlock(&mm->page_table_lock);
return n - done; return n - done;
fault: fault:
......
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