fs/dcache.c: avoid panic while lockref of dentry overflow
hulk inclusion category: bugfix bugzilla: 185799, https://gitee.com/openeuler/kernel/issues/I4JWYM CVE: NA --------------------------- We use lockref for dentry reference without notice that so many negative dentry under one dir can lead to overflow of lockref. This can lead to system crash if we do this under root dir. Since there is not a perfect solution, we just limit max number of dentry count up to INT_MAX / 2. Also, it will cost a lot of time from INT_MAX / 2 to INT_MAX, so we no need to do this under protection of dentry lock. Also, we limit the FILES_MAX to INT_MAX / 2, since a lot open for same file can lead to overflow too. Changelog: v1->v2: add a function to do check / add a Macro to mean INT_MAX / 2 Signed-off-by: Nyangerkun <yangerkun@huawei.com> Reviewed-by: NMiao Xie <miaoxie@huawei.com> Signed-off-by: NYang Yingliang <yangyingliang@huawei.com> Conflicts: fs/dcache.c Reviewed-by: NZhang Yi <yi.zhang@huawei.com> Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
Showing
想要评论请 注册 或 登录