Whamcloud - gitweb
LU-12169 llite: fill copied dentry name's ending char properly 11/34611/3
authorWang Shilong <wshilong@ddn.com>
Mon, 8 Apr 2019 13:22:45 +0000 (21:22 +0800)
committerOleg Drokin <green@whamcloud.com>
Tue, 30 Apr 2019 03:37:50 +0000 (03:37 +0000)
commitbc9cc327983c45e6255e0d6475b8bdbdcd82c938
tree796edb21facb30d8d719202f559a791280814fd2
parent707eabca41e407d702fa975afc2ccd59641335bb
LU-12169 llite: fill copied dentry name's ending char properly

Dentry name expect an extra '\0'. and dentry_len won't calcualte
extra '\0' for it, but we should allocate memory and fill it
when copying dentry name by ourselves.

Otherwise, lu_name_is_valid_2() will try to access @name[len]
and check whether it is '\0'. this is invalid memory access.
We will possibly hit a crash if the first access that bit is '\0'.
and the bit overwritten by someone else, and finally we failed
sanity check in mdc_name_pack().

LustreError: 157839:0:(mdc_lib.c:137:mdc_pack_name()) LBUG

Fixes: f575b65("LU-12020 llite: make sure name pack atomic")
Change-Id: I533e19a0e6efb0fca5a46bcdbdb0006d1b1bedab
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Reviewed-on: https://review.whamcloud.com/34611
Tested-by: Jenkins
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Gu Zheng <gzheng@ddn.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/include/obd_support.h
lustre/llite/file.c
lustre/tests/sanity.sh