linux/fs/ubifs
Guochun Mao 6c9b98a66d ubifs: Only check replay with inode type to judge if inode linked
commit 3e903315790baf4a966436e7f32e9c97864570ac upstream.

Conside the following case, it just write a big file into flash,
when complete writing, delete the file, and then power off promptly.
Next time power on, we'll get a replay list like:
...
LEB 1105:211344 len 4144 deletion 0 sqnum 428783 key type 1 inode 80
LEB 15:233544 len 160 deletion 1 sqnum 428785 key type 0 inode 80
LEB 1105:215488 len 4144 deletion 0 sqnum 428787 key type 1 inode 80
...
In the replay list, data nodes' deletion are 0, and the inode node's
deletion is 1. In current logic, the file's dentry will be removed,
but inode and the flash space it occupied will be reserved.
User will see that much free space been disappeared.

We only need to check the deletion value of the following inode type
node of the replay entry.

Fixes: e58725d51f ("ubifs: Handle re-linking of inodes correctly while recovery")
Cc: stable@vger.kernel.org
Signed-off-by: Guochun Mao <guochun.mao@mediatek.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-05-11 14:04:14 +02:00
..
Kconfig
Makefile
auth.c ubifs: Fix memleak in ubifs_init_authentication 2021-03-04 10:26:25 +01:00
budget.c
commit.c
compress.c
crypto.c
debug.c ubifs: dent: Fix some potential memory leaks while iterating entries 2020-11-05 11:43:32 +01:00
debug.h
dir.c ubifs: prevent creating duplicate encrypted filenames 2021-01-06 14:48:35 +01:00
file.c ubifs: remove broken lazytime support 2020-05-27 17:46:14 +02:00
find.c
gc.c
io.c ubifs: wbuf: Don't leak kernel memory to flash 2020-12-30 11:51:40 +01:00
ioctl.c
journal.c ubifs: journal: Make sure to not dirty twice for auth nodes 2020-11-05 11:43:32 +01:00
key.h
log.c
lprops.c
lpt.c
lpt_commit.c
master.c
misc.c
misc.h
orphan.c ubifs: xattr: Fix some potential memory leaks while iterating entries 2020-11-05 11:43:32 +01:00
recovery.c
replay.c ubifs: Only check replay with inode type to judge if inode linked 2021-05-11 14:04:14 +02:00
sb.c
scan.c
shrinker.c
super.c ubifs: Fix error return code in alloc_wbufs() 2021-03-04 10:26:26 +01:00
tnc.c ubifs: xattr: Fix some potential memory leaks while iterating entries 2020-11-05 11:43:32 +01:00
tnc_commit.c
tnc_misc.c
ubifs-media.h
ubifs.h
xattr.c ubifs: xattr: Fix some potential memory leaks while iterating entries 2020-11-05 11:43:32 +01:00