]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
os/FileStore: fix fiemap double-free(s)
authorAlan Somers <asomers@gmail.com>
Tue, 15 Oct 2013 20:26:13 +0000 (13:26 -0700)
committerSage Weil <sage@inktank.com>
Tue, 15 Oct 2013 20:26:15 +0000 (13:26 -0700)
commitbd7a7dd6896b175ed15749800ce0ae6a7f0525bd
treec9099f8c8cb82bc2e16eab0586b3bf4ee6649144
parent26228ed701870a3625a41f798359d4e550b248b8
os/FileStore: fix fiemap double-free(s)

If GenericFileStoreBackend::do_fiemap returns anything other than 0, then
fiemap will not be allocated. However,
GenericFileStoreBackend::detect_features will free fiemap regardless,
triggering an assertion in tcmalloc. The attached patch will fix the bug
by only freeing fiemap when necessary.

In my case, do_fiemap returns -ENOSYS because fiemap is not implemented
on FreeBSD. However, this bug could also happen on Linux when do_fiemap
returns -ENOMEM.

Fixes: #6504
Signed-off-by: Alan Somers <asomers@gmail.com>
Reviewed-by: Sage Weil <sage@inktank.com>
src/os/FileStore.cc
src/os/GenericFileStoreBackend.cc