fs/hfsplus/extents.c: fix concurrent acess of alloc_blocks
authorSougata Santra <sougata@tuxera.com>
Thu, 3 Apr 2014 21:50:34 +0000 (14:50 -0700)
committerJiri Slaby <jslaby@suse.cz>
Wed, 19 Nov 2014 22:44:32 +0000 (23:44 +0100)
commit7357404a711a32bcade125a84a07edca78e71361
tree688b2db847b323538b7fd4300eb660f3b37903dd
parent291e7f11b9028ac9e418e15ebae1d30a94b59382
fs/hfsplus/extents.c: fix concurrent acess of alloc_blocks

commit d7bdb996aef67ea24c62707ca4e29b07025e9683 upstream.

Concurrent access to alloc_blocks in hfsplus_inode_info() is protected
by extents_lock mutex.  This patch fixes two instances where
alloc_blocks modification was not protected with this lock.

This fixes possible allocation bitmap corruption in race conditions
while extending and truncating files.

[akpm@linux-foundation.org: take extents_lock before taking a copy of ->alloc_blocks]
[akpm@linux-foundation.org: remove now-unused label `out']
Signed-off-by: Sougata Santra <sougata@tuxera.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Cc: Vyacheslav Dubeyko <slava@dubeyko.com>
Cc: Alexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
fs/hfsplus/extents.c