Whamcloud - gitweb
LU-7980 ldiskfs: always pre-allocate max depth for path
Upon very specific meta-data and I/O pattern a situation can be
encountered where ext_depth() will concurrently (due to i_data_sem
release) grow outside of currently used ext4_ext_path[] array
boundary.
This can lead to potential Slab overrun if current ext_depth()
is used to index previously sized+allocated ext4_ext_path[] array.
This patch fixes this by already pre-allocating _ext_path[]
array of the max possible depth.
This is an alternate way to avoid racy cases, that can lead to
slab overrun, with current and unsafe implementation that causes
ext4_ext_path[] array re-[sizing,allocation] based on current depth.
Now unnecessay free an realloc upon depth change detection prior to
reuse already allocated path space have also been removed.
Signed-off-by: Bruno Faccini <bruno.faccini@intel.com>
Change-Id: I0ae955c5eccf032cb02ef55c6381964a5eaf82c2
Reviewed-on: http://review.whamcloud.com/19349
Tested-by: Jenkins
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>