android_kernel_xiaomi_sm7250/fs/ocfs2
Joseph Qi 1739f56956 ocfs2: fix BUG when iput after ocfs2_mknod fails
commit 759a7c6126eef5635506453e9b9d55a6a3ac2084 upstream.

Commit b1529a41f7 "ocfs2: should reclaim the inode if
'__ocfs2_mknod_locked' returns an error" tried to reclaim the claimed
inode if __ocfs2_mknod_locked() fails later.  But this introduce a race,
the freed bit may be reused immediately by another thread, which will
update dinode, e.g.  i_generation.  Then iput this inode will lead to BUG:
inode->i_generation != le32_to_cpu(fe->i_generation)

We could make this inode as bad, but we did want to do operations like
wipe in some cases.  Since the claimed inode bit can only affect that an
dinode is missing and will return back after fsck, it seems not a big
problem.  So just leave it as is by revert the reclaim logic.

Link: https://lkml.kernel.org/r/20221017130227.234480-1-joseph.qi@linux.alibaba.com
Fixes: b1529a41f7 ("ocfs2: should reclaim the inode if '__ocfs2_mknod_locked' returns an error")
Signed-off-by: Joseph Qi <joseph.qi@linux.alibaba.com>
Reported-by: Yan Wang <wangyan122@huawei.com>
Cc: Mark Fasheh <mark@fasheh.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Junxiao Bi <junxiao.bi@oracle.com>
Cc: Changwei Ge <gechangwei@live.cn>
Cc: Gang He <ghe@suse.com>
Cc: Jun Piao <piaojun@huawei.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-11-03 23:52:24 +09:00
..
cluster ocfs2: fix a use after free on error 2021-03-04 09:39:50 +01:00
dlm
dlmfs ocfs2: dlmfs: fix error handling of user_dlm_destroy_lock 2022-06-14 16:59:28 +02:00
acl.c
acl.h
alloc.c ocfs2: fix data corruption after conversion from inline format 2021-10-27 09:53:13 +02:00
alloc.h
aops.c ocfs2: fix deadlock between setattr and dio_end_io_write 2021-04-14 08:22:32 +02:00
aops.h
blockcheck.c
blockcheck.h
buffer_head_io.c
buffer_head_io.h
dcache.c
dcache.h
dir.c
dir.h
dlmglue.c ocfs2: drop acl cache for directories too 2021-10-06 15:31:09 +02:00
dlmglue.h
export.c
export.h
extent_map.c
extent_map.h
file.c ocfs2: fix data corruption on truncate 2021-11-26 11:35:57 +01:00
file.h
filecheck.c ocfs2: fix snprintf() checking 2021-07-20 16:15:49 +02:00
filecheck.h
heartbeat.c
heartbeat.h
inode.c
inode.h
ioctl.c
ioctl.h
journal.c
journal.h
Kconfig
localalloc.c
localalloc.h
locks.c
locks.h
Makefile
mmap.c
mmap.h
move_extents.c
move_extents.h
namei.c ocfs2: fix BUG when iput after ocfs2_mknod fails 2022-11-03 23:52:24 +09:00
namei.h
ocfs1_fs_compat.h
ocfs2_fs.h ocfs2: fix value of OCFS2_INVALID_SLOT 2020-06-30 23:17:17 -04:00
ocfs2_ioctl.h
ocfs2_lockid.h
ocfs2_lockingver.h
ocfs2_trace.h
ocfs2.h ocfs2: change slot number type s16 to u16 2020-08-21 11:05:33 +02:00
quota_global.c
quota_local.c
quota.h
refcounttree.c
refcounttree.h
reservations.c
reservations.h
resize.c
resize.h
slot_map.c
slot_map.h
stack_o2cb.c
stack_user.c
stackglue.c ocfs2: fix snprintf() checking 2021-07-20 16:15:49 +02:00
stackglue.h
suballoc.c ocfs2: change slot number type s16 to u16 2020-08-21 11:05:33 +02:00
suballoc.h
super.c ocfs2: fix crash when initialize filecheck kobj fails 2022-03-23 09:10:44 +01:00
super.h
symlink.c
symlink.h
sysfile.c
sysfile.h
uptodate.c
uptodate.h
xattr.c
xattr.h