Skip to content

Commit a1cd6c2

Browse files
Mikulas Patockatorvalds
Mikulas Patocka
authored andcommitted
arch/x86/lib/usercopy_64.c: fix __copy_user_flushcache() cache writeback
If we copy less than 8 bytes and if the destination crosses a cache line, __copy_user_flushcache would invalidate only the first cache line. This patch makes it invalidate the second cache line as well. Fixes: 0aed55a ("x86, uaccess: introduce copy_from_iter_flushcache for pmem / cache-bypass operations") Signed-off-by: Mikulas Patocka <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Reviewed-by: Dan Williams <[email protected]> Cc: Jan Kara <[email protected]> Cc: Jeff Moyer <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Christoph Hellwig <[email protected]> Cc: Toshi Kani <[email protected]> Cc: "H. Peter Anvin" <[email protected]> Cc: Al Viro <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Matthew Wilcox <[email protected]> Cc: Ross Zwisler <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: <[email protected]> Link: https://lkml.kernel.org/r/alpine.LRH.2.02.2009161451140.21915@file01.intranet.prod.int.rdu2.redhat.com Signed-off-by: Linus Torvalds <[email protected]>
1 parent ffa550c commit a1cd6c2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/x86/lib/usercopy_64.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ long __copy_user_flushcache(void *dst, const void __user *src, unsigned size)
120120
*/
121121
if (size < 8) {
122122
if (!IS_ALIGNED(dest, 4) || size != 4)
123-
clean_cache_range(dst, 1);
123+
clean_cache_range(dst, size);
124124
} else {
125125
if (!IS_ALIGNED(dest, 8)) {
126126
dest = ALIGN(dest, boot_cpu_data.x86_clflush_size);

0 commit comments

Comments
 (0)