linux-stable/fs/kernfs
Amir Goldstein bb43c568f7 kernfs: annotate different lockdep class for of->mutex of writable files
commit 16b52bbee4 upstream.

The writable file /sys/power/resume may call vfs lookup helpers for
arbitrary paths and readonly files can be read by overlayfs from vfs
helpers when sysfs is a lower layer of overalyfs.

To avoid a lockdep warning of circular dependency between overlayfs
inode lock and kernfs of->mutex, use a different lockdep class for
writable and readonly kernfs files.

Reported-by: syzbot+9a5b0ced8b1bfb238b56@syzkaller.appspotmail.com
Fixes: 0fedefd4c4 ("kernfs: sysfs: support custom llseek method for sysfs entries")
Suggested-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-04-17 11:23:40 +02:00
..
Kconfig treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
dir.c kernfs: RCU protect kernfs_nodes and avoid kernfs_idr_lock in kernfs_find_and_get_node_by_id() 2024-04-13 13:10:09 +02:00
file.c kernfs: annotate different lockdep class for of->mutex of writable files 2024-04-17 11:23:40 +02:00
inode.c vfs-6.7.ctime 2023-10-30 09:47:13 -10:00
kernfs-internal.h kernfs: RCU protect kernfs_nodes and avoid kernfs_idr_lock in kernfs_find_and_get_node_by_id() 2024-04-13 13:10:09 +02:00
mount.c kernfs: d_obtain_alias(NULL) will do the right thing... 2023-12-20 07:24:35 +01:00
symlink.c kernfs: fix all kernel-doc warnings and multiple typos 2022-11-23 19:28:26 +01:00