Commit fa8609da authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] ntfs: kmap_atomic() atomicity fix

The KM_BIO_SRC_IRQ kmap slot requires local irq protection.
Acked-by: default avatarAnton Altaparmakov <aia21@cantab.net>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 3896625d
...@@ -92,10 +92,12 @@ static void ntfs_end_buffer_async_read(struct buffer_head *bh, int uptodate) ...@@ -92,10 +92,12 @@ static void ntfs_end_buffer_async_read(struct buffer_head *bh, int uptodate)
ofs = 0; ofs = 0;
if (file_ofs < init_size) if (file_ofs < init_size)
ofs = init_size - file_ofs; ofs = init_size - file_ofs;
local_irq_save(flags);
kaddr = kmap_atomic(page, KM_BIO_SRC_IRQ); kaddr = kmap_atomic(page, KM_BIO_SRC_IRQ);
memset(kaddr + bh_offset(bh) + ofs, 0, memset(kaddr + bh_offset(bh) + ofs, 0,
bh->b_size - ofs); bh->b_size - ofs);
kunmap_atomic(kaddr, KM_BIO_SRC_IRQ); kunmap_atomic(kaddr, KM_BIO_SRC_IRQ);
local_irq_restore(flags);
flush_dcache_page(page); flush_dcache_page(page);
} }
} else { } else {
...@@ -143,11 +145,13 @@ static void ntfs_end_buffer_async_read(struct buffer_head *bh, int uptodate) ...@@ -143,11 +145,13 @@ static void ntfs_end_buffer_async_read(struct buffer_head *bh, int uptodate)
recs = PAGE_CACHE_SIZE / rec_size; recs = PAGE_CACHE_SIZE / rec_size;
/* Should have been verified before we got here... */ /* Should have been verified before we got here... */
BUG_ON(!recs); BUG_ON(!recs);
local_irq_save(flags);
kaddr = kmap_atomic(page, KM_BIO_SRC_IRQ); kaddr = kmap_atomic(page, KM_BIO_SRC_IRQ);
for (i = 0; i < recs; i++) for (i = 0; i < recs; i++)
post_read_mst_fixup((NTFS_RECORD*)(kaddr + post_read_mst_fixup((NTFS_RECORD*)(kaddr +
i * rec_size), rec_size); i * rec_size), rec_size);
kunmap_atomic(kaddr, KM_BIO_SRC_IRQ); kunmap_atomic(kaddr, KM_BIO_SRC_IRQ);
local_irq_restore(flags);
flush_dcache_page(page); flush_dcache_page(page);
if (likely(page_uptodate && !PageError(page))) if (likely(page_uptodate && !PageError(page)))
SetPageUptodate(page); SetPageUptodate(page);
......
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