diff options
author | Kazuya Mio <k-mio@sx.jp.nec.com> | 2010-11-18 21:51:25 +0000 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2010-12-24 14:43:13 -0500 |
commit | b07f014face2e2aa0abf8a3266fd716152cd0cd4 (patch) | |
tree | 2a50074111d63a8bf0f1c5573e7cd341b80fb626 /misc/e4defrag.c | |
parent | da2a5a4baede2a227d2da587eb74ceae66778fbc (diff) | |
download | e2fsprogs-b07f014face2e2aa0abf8a3266fd716152cd0cd4.tar.gz |
e4defrag: fix segfault when e4defrag races with unlink/truncate
If a file gets deleted or truncated while e4defrag is trying to
operate on it, it's possible for it seg fault.
Addresses-Red-Hat-Bugzilla: #641926
Reported-by: Michal Piotrowski <mkkp4x4@gmail.com>
Signed-off-by: Kazuya Mio <k-mio@sx.jp.nec.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'misc/e4defrag.c')
-rw-r--r-- | misc/e4defrag.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/misc/e4defrag.c b/misc/e4defrag.c index e795987c..9008bc27 100644 --- a/misc/e4defrag.c +++ b/misc/e4defrag.c @@ -942,7 +942,7 @@ static int get_file_extents(int fd, struct fiemap_extent_list **ext_list_head) fiemap_buf->fm_start = pos; memset(ext_buf, 0, ext_buf_size); ret = ioctl(fd, FS_IOC_FIEMAP, fiemap_buf); - if (ret < 0) + if (ret < 0 || fiemap_buf->fm_mapped_extents == 0) goto out; for (i = 0; i < fiemap_buf->fm_mapped_extents; i++) { ext_list = NULL; |