mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 12:28:41 +08:00
ovl: validate superblock in OVL_FS()
When CONFIG_OVERLAY_FS_DEBUG is enabled add an explicit check to make sure that OVL_FS() is always used with a valid overlayfs superblock. Otherwise trigger a WARN_ON_ONCE(). Reviewed-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Andrea Righi <andrea.righi@canonical.com> Signed-off-by: Amir Goldstein <amir73il@gmail.com>
This commit is contained in:
parent
f01d08899f
commit
adcd459ff8
@ -121,6 +121,9 @@ extern struct file_system_type ovl_fs_type;
|
||||
|
||||
static inline struct ovl_fs *OVL_FS(struct super_block *sb)
|
||||
{
|
||||
if (IS_ENABLED(CONFIG_OVERLAY_FS_DEBUG))
|
||||
WARN_ON_ONCE(sb->s_type != &ovl_fs_type);
|
||||
|
||||
return (struct ovl_fs *)sb->s_fs_info;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user