[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <74bf47cac98b4282480ae6ed99e797d07b9c2424.1478523828.git.jslaby@suse.cz>
Date: Mon, 7 Nov 2016 14:04:21 +0100
From: Jiri Slaby <jslaby@...e.cz>
To: stable@...r.kernel.org
Cc: linux-kernel@...r.kernel.org,
Andrew Bresticker <abrestic@...omium.org>,
Enric Balletbo Serra <enric.balletbo@...labora.com>,
Kees Cook <keescook@...omium.org>, Jiri Slaby <jslaby@...e.cz>
Subject: [PATCH 3.12 14/72] pstore/ram: Use memcpy_fromio() to save old buffer
From: Andrew Bresticker <abrestic@...omium.org>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit d771fdf94180de2bd811ac90cba75f0f346abf8d upstream.
The ramoops buffer may be mapped as either I/O memory or uncached
memory. On ARM64, this results in a device-type (strongly-ordered)
mapping. Since unnaligned accesses to device-type memory will
generate an alignment fault (regardless of whether or not strict
alignment checking is enabled), it is not safe to use memcpy().
memcpy_fromio() is guaranteed to only use aligned accesses, so use
that instead.
Signed-off-by: Andrew Bresticker <abrestic@...omium.org>
Signed-off-by: Enric Balletbo Serra <enric.balletbo@...labora.com>
Reviewed-by: Puneet Kumar <puneetster@...omium.org>
Signed-off-by: Kees Cook <keescook@...omium.org>
Signed-off-by: Jiri Slaby <jslaby@...e.cz>
---
fs/pstore/ram_core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/pstore/ram_core.c b/fs/pstore/ram_core.c
index eb42483dbb05..7df456db7c33 100644
--- a/fs/pstore/ram_core.c
+++ b/fs/pstore/ram_core.c
@@ -286,8 +286,8 @@ void persistent_ram_save_old(struct persistent_ram_zone *prz)
}
prz->old_log_size = size;
- memcpy(prz->old_log, &buffer->data[start], size - start);
- memcpy(prz->old_log + size - start, &buffer->data[0], start);
+ memcpy_fromio(prz->old_log, &buffer->data[start], size - start);
+ memcpy_fromio(prz->old_log + size - start, &buffer->data[0], start);
}
int notrace persistent_ram_write(struct persistent_ram_zone *prz,
--
2.10.2
Powered by blists - more mailing lists