Whamcloud - gitweb
LU-4708 ldiskfs: do not copy NUL terminator from direntry 10/9510/2
authorAndreas Dilger <andreas.dilger@intel.com>
Wed, 5 Mar 2014 18:59:30 +0000 (11:59 -0700)
committerOleg Drokin <oleg.drokin@intel.com>
Mon, 10 Mar 2014 23:51:15 +0000 (23:51 +0000)
commita101a95a3f58cde3ed912d074dc283b4083672ff
tree5ac3524b1d8947e82c38996e06d85e6cfd4e0fe9
parentc6ab1fcc056778b18f685ec591ce27907e887617
LU-4708 ldiskfs: do not copy NUL terminator from direntry

Do not try to copy a NUL terminator from the source dirent if there
is no dir_data for that record.  This can happen with 1.x filesystems
that do not have a dirdata field in the dirent to store the FID.

The target buffer is expected to be NUL terminated, and this is
handled by using kzalloc() to allocate it and zero out the buffer,
but the source buffer may not have a trailing NUL byte if it is a
multiple of 4 bytes in length.

If the dirent is aligned at the end of the directory block/page this
can cause an oops by accessing beyond the end of the page, or will
otherwise copy a garbage byte to the target buffer.

Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Change-Id: Iab52f916d7571b3d2587255280c72a52c60399c9
Reviewed-on: http://review.whamcloud.com/9510
Tested-by: Jenkins
Reviewed-by: Niu Yawei <yawei.niu@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Fan Yong <fan.yong@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
ldiskfs/kernel_patches/patches/rhel6.3/ext4-data-in-dirent.patch
ldiskfs/kernel_patches/patches/sles11sp2/ext4-data-in-dirent.patch