diff options
author | David S. Miller <davem@davemloft.net> | 2010-10-21 11:43:05 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-10-21 11:43:05 -0400 |
commit | 2198a10b501fd4443430cb17e065a9e859cc58c9 (patch) | |
tree | 87f3781d293da0f8f8f61615905eb7bf62b7c128 /net/rds | |
parent | 9941fb62762253774cc6177d0b9172ece5133fe1 (diff) | |
parent | db5a753bf198ef7a50e17d2ff358adf37efe8648 (diff) |
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Conflicts:
net/core/dev.c
Diffstat (limited to 'net/rds')
-rw-r--r-- | net/rds/page.c | 27 |
1 files changed, 7 insertions, 20 deletions
diff --git a/net/rds/page.c b/net/rds/page.c index a3e2e0ac8a60..d8acdebe3c7c 100644 --- a/net/rds/page.c +++ b/net/rds/page.c | |||
@@ -58,30 +58,17 @@ int rds_page_copy_user(struct page *page, unsigned long offset, | |||
58 | unsigned long ret; | 58 | unsigned long ret; |
59 | void *addr; | 59 | void *addr; |
60 | 60 | ||
61 | if (to_user) | 61 | addr = kmap(page); |
62 | if (to_user) { | ||
62 | rds_stats_add(s_copy_to_user, bytes); | 63 | rds_stats_add(s_copy_to_user, bytes); |
63 | else | 64 | ret = copy_to_user(ptr, addr + offset, bytes); |
65 | } else { | ||
64 | rds_stats_add(s_copy_from_user, bytes); | 66 | rds_stats_add(s_copy_from_user, bytes); |
65 | 67 | ret = copy_from_user(addr + offset, ptr, bytes); | |
66 | addr = kmap_atomic(page, KM_USER0); | ||
67 | if (to_user) | ||
68 | ret = __copy_to_user_inatomic(ptr, addr + offset, bytes); | ||
69 | else | ||
70 | ret = __copy_from_user_inatomic(addr + offset, ptr, bytes); | ||
71 | kunmap_atomic(addr, KM_USER0); | ||
72 | |||
73 | if (ret) { | ||
74 | addr = kmap(page); | ||
75 | if (to_user) | ||
76 | ret = copy_to_user(ptr, addr + offset, bytes); | ||
77 | else | ||
78 | ret = copy_from_user(addr + offset, ptr, bytes); | ||
79 | kunmap(page); | ||
80 | if (ret) | ||
81 | return -EFAULT; | ||
82 | } | 68 | } |
69 | kunmap(page); | ||
83 | 70 | ||
84 | return 0; | 71 | return ret ? -EFAULT : 0; |
85 | } | 72 | } |
86 | EXPORT_SYMBOL_GPL(rds_page_copy_user); | 73 | EXPORT_SYMBOL_GPL(rds_page_copy_user); |
87 | 74 | ||