]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commit
xfsprogs: Fix possible unallocated memory access in fiemap
authorEric Sandeen <sandeen@sandeen.net>
Fri, 25 Jan 2013 21:10:22 +0000 (21:10 +0000)
committerMark Tinguely <tinguely@eagdhcp-232-136.americas.sgi.com>
Thu, 21 Feb 2013 16:09:11 +0000 (10:09 -0600)
commitb3a5164e6e474f03cd2d5e6d5168d4ced3d3282b
treec95a73a50b4253bfe3e3ff16b8755f9d2662fdf3
parent21f4e23356f1723ab67d8cf06f399410cb207af0
xfsprogs: Fix possible unallocated memory access in fiemap

(Based on original patch by Lukas Czerner & comments by Dave Chinner)

Currently we could access unallocated memory in fiemap because we're
using uninitialized variable 'fiemap' in fiemap_f(). In fact this has
been spotted on x390s machine where xfs_io would segfault.

The problem happens in the for cycle which seems to be intended to
compute the header item spacing. However at that point the fiemap
structure has just been allocated and does not contain any extents
yet, so it is entirely useless and it never actually worked.

This patch delays the format calculation until the first batch
of extents has come in for analysis.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Mark Tinguely <tinguely@sgi.com>
Signed-off-by: Mark Tinguely <tinguely@sgi.com>
io/fiemap.c