diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-06-20 18:15:03 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-06-20 18:15:03 -0400 |
commit | bc259adc9b76f625fff0423df3ffb80a03802927 (patch) | |
tree | 68082b9f84a90eaaa8ed5b3ac3177eac32f9fe39 /fs/pstore | |
parent | fe80352460971de12519bf46ed5ec4235350bcd7 (diff) | |
parent | 3026b0e942c65c65c8fc80d391d004228b52b916 (diff) |
Merge tag 'staging-3.5-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging
Pull staging tree fixes from Greg Kroah-Hartman:
"Here are a number of small fixes for the drivers/staging tree, as well
as iio and pstore drivers (which came from the staging tree in the
3.5-rc1 merge). All of these are tiny, but resolve issues that people
have been reporting.
There's also a documentation update to reflect what the iio drivers
really are doing, which is good to get straightened out.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>"
* tag 'staging-3.5-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging:
staging: r8712u: Add new USB IDs
staging: gdm72xx: Release netlink socket properly
iio: drop wrong reference from Kconfig
pstore/inode: Make pstore_fill_super() static
pstore/ram: Should zap persistent zone on unlink
pstore/ram_core: Factor persistent_ram_zap() out of post_init()
pstore/ram_core: Do not reset restored zone's position and size
pstore/ram: Should update old dmesg buffer before reading
staging:iio:ad7298: Fix linker error due to missing IIO kfifo buffer
Revert "staging: usbip: bugfix for stack corruption on 64-bit architectures"
staging: usbip: bugfix for stack corruption on 64-bit architectures
staging/comedi: fix build for USB not enabled
staging: omapdrm: fix crash when freeing bad fb
staging:iio:ad7606: Re-add missing scale attribute
iio: Fix potential use after free
staging:iio: remove num_interrupt_lines from documentation
iio: documentation: Add out_altvoltage and friends
Diffstat (limited to 'fs/pstore')
-rw-r--r-- | fs/pstore/inode.c | 2 | ||||
-rw-r--r-- | fs/pstore/ram.c | 3 | ||||
-rw-r--r-- | fs/pstore/ram_core.c | 27 |
3 files changed, 21 insertions, 11 deletions
diff --git a/fs/pstore/inode.c b/fs/pstore/inode.c index aeb19e68e086..11a2aa2a56c4 100644 --- a/fs/pstore/inode.c +++ b/fs/pstore/inode.c | |||
@@ -258,7 +258,7 @@ fail: | |||
258 | return rc; | 258 | return rc; |
259 | } | 259 | } |
260 | 260 | ||
261 | int pstore_fill_super(struct super_block *sb, void *data, int silent) | 261 | static int pstore_fill_super(struct super_block *sb, void *data, int silent) |
262 | { | 262 | { |
263 | struct inode *inode; | 263 | struct inode *inode; |
264 | 264 | ||
diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c index 9123cce28c1e..453030f9c5bc 100644 --- a/fs/pstore/ram.c +++ b/fs/pstore/ram.c | |||
@@ -106,6 +106,8 @@ static ssize_t ramoops_pstore_read(u64 *id, enum pstore_type_id *type, | |||
106 | time->tv_sec = 0; | 106 | time->tv_sec = 0; |
107 | time->tv_nsec = 0; | 107 | time->tv_nsec = 0; |
108 | 108 | ||
109 | /* Update old/shadowed buffer. */ | ||
110 | persistent_ram_save_old(prz); | ||
109 | size = persistent_ram_old_size(prz); | 111 | size = persistent_ram_old_size(prz); |
110 | *buf = kmalloc(size, GFP_KERNEL); | 112 | *buf = kmalloc(size, GFP_KERNEL); |
111 | if (*buf == NULL) | 113 | if (*buf == NULL) |
@@ -184,6 +186,7 @@ static int ramoops_pstore_erase(enum pstore_type_id type, u64 id, | |||
184 | return -EINVAL; | 186 | return -EINVAL; |
185 | 187 | ||
186 | persistent_ram_free_old(cxt->przs[id]); | 188 | persistent_ram_free_old(cxt->przs[id]); |
189 | persistent_ram_zap(cxt->przs[id]); | ||
187 | 190 | ||
188 | return 0; | 191 | return 0; |
189 | } | 192 | } |
diff --git a/fs/pstore/ram_core.c b/fs/pstore/ram_core.c index 31f8d184f3a0..c5fbdbbf81ac 100644 --- a/fs/pstore/ram_core.c +++ b/fs/pstore/ram_core.c | |||
@@ -250,23 +250,24 @@ static void notrace persistent_ram_update(struct persistent_ram_zone *prz, | |||
250 | persistent_ram_update_ecc(prz, start, count); | 250 | persistent_ram_update_ecc(prz, start, count); |
251 | } | 251 | } |
252 | 252 | ||
253 | static void __init | 253 | void persistent_ram_save_old(struct persistent_ram_zone *prz) |
254 | persistent_ram_save_old(struct persistent_ram_zone *prz) | ||
255 | { | 254 | { |
256 | struct persistent_ram_buffer *buffer = prz->buffer; | 255 | struct persistent_ram_buffer *buffer = prz->buffer; |
257 | size_t size = buffer_size(prz); | 256 | size_t size = buffer_size(prz); |
258 | size_t start = buffer_start(prz); | 257 | size_t start = buffer_start(prz); |
259 | char *dest; | ||
260 | 258 | ||
261 | persistent_ram_ecc_old(prz); | 259 | if (!size) |
260 | return; | ||
262 | 261 | ||
263 | dest = kmalloc(size, GFP_KERNEL); | 262 | if (!prz->old_log) { |
264 | if (dest == NULL) { | 263 | persistent_ram_ecc_old(prz); |
264 | prz->old_log = kmalloc(size, GFP_KERNEL); | ||
265 | } | ||
266 | if (!prz->old_log) { | ||
265 | pr_err("persistent_ram: failed to allocate buffer\n"); | 267 | pr_err("persistent_ram: failed to allocate buffer\n"); |
266 | return; | 268 | return; |
267 | } | 269 | } |
268 | 270 | ||
269 | prz->old_log = dest; | ||
270 | prz->old_log_size = size; | 271 | prz->old_log_size = size; |
271 | memcpy(prz->old_log, &buffer->data[start], size - start); | 272 | memcpy(prz->old_log, &buffer->data[start], size - start); |
272 | memcpy(prz->old_log + size - start, &buffer->data[0], start); | 273 | memcpy(prz->old_log + size - start, &buffer->data[0], start); |
@@ -319,6 +320,13 @@ void persistent_ram_free_old(struct persistent_ram_zone *prz) | |||
319 | prz->old_log_size = 0; | 320 | prz->old_log_size = 0; |
320 | } | 321 | } |
321 | 322 | ||
323 | void persistent_ram_zap(struct persistent_ram_zone *prz) | ||
324 | { | ||
325 | atomic_set(&prz->buffer->start, 0); | ||
326 | atomic_set(&prz->buffer->size, 0); | ||
327 | persistent_ram_update_header_ecc(prz); | ||
328 | } | ||
329 | |||
322 | static void *persistent_ram_vmap(phys_addr_t start, size_t size) | 330 | static void *persistent_ram_vmap(phys_addr_t start, size_t size) |
323 | { | 331 | { |
324 | struct page **pages; | 332 | struct page **pages; |
@@ -405,6 +413,7 @@ static int __init persistent_ram_post_init(struct persistent_ram_zone *prz, bool | |||
405 | " size %zu, start %zu\n", | 413 | " size %zu, start %zu\n", |
406 | buffer_size(prz), buffer_start(prz)); | 414 | buffer_size(prz), buffer_start(prz)); |
407 | persistent_ram_save_old(prz); | 415 | persistent_ram_save_old(prz); |
416 | return 0; | ||
408 | } | 417 | } |
409 | } else { | 418 | } else { |
410 | pr_info("persistent_ram: no valid data in buffer" | 419 | pr_info("persistent_ram: no valid data in buffer" |
@@ -412,8 +421,7 @@ static int __init persistent_ram_post_init(struct persistent_ram_zone *prz, bool | |||
412 | } | 421 | } |
413 | 422 | ||
414 | prz->buffer->sig = PERSISTENT_RAM_SIG; | 423 | prz->buffer->sig = PERSISTENT_RAM_SIG; |
415 | atomic_set(&prz->buffer->start, 0); | 424 | persistent_ram_zap(prz); |
416 | atomic_set(&prz->buffer->size, 0); | ||
417 | 425 | ||
418 | return 0; | 426 | return 0; |
419 | } | 427 | } |
@@ -448,7 +456,6 @@ struct persistent_ram_zone * __init persistent_ram_new(phys_addr_t start, | |||
448 | goto err; | 456 | goto err; |
449 | 457 | ||
450 | persistent_ram_post_init(prz, ecc); | 458 | persistent_ram_post_init(prz, ecc); |
451 | persistent_ram_update_header_ecc(prz); | ||
452 | 459 | ||
453 | return prz; | 460 | return prz; |
454 | err: | 461 | err: |