This pull request contains updates for UBI and UBIFS

- UBI Fastmap improvements
- Minor issues found by static analysis bots in both UBI and UBIFS
- Fix for wrong dentry length UBIFS in fscrypt mode
ubifs: ubifs_link: Fix wrong name len calculating when UBIFS is encrypted

The length of dentry name is calculated after the raw name is encrypted,
except for ubifs_link(), which could make the size of dir underflow.
Here is a reproducer:

 touch $TMP/file
 mkdir $TMP/dir
 stat $TMP/dir
 for i in $(seq 1 8)
   ln $TMP/file $TMP/dir/$i
   unlink $TMP/dir/$i
 stat $TMP/dir

The size of dir will be underflow(-96).

Fix it by calculating dentry name's length after the name is encrypted.

Fixes: f4f61d2cc6d8 ("ubifs: Implement encrypted filenames")
Reported-by: Roland Ruckerbauer <>
Signed-off-by: Zhihao Cheng <>
Signed-off-by: Richard Weinberger <>
1 file changed