fs/dirty_pages: fix kernel panic in concurrency mode
euler inclusion category: bugfix bugzilla: 46858 CVE: NA --------------------------- The present code doesn't support concurrency mode, test it this way will cause kernel panic. The reason is that 'buff_used' didn't use any concurrent access mechanism. Fix the problem by following changes: 1. move the initialization of buffer from proc_dpages_open to seq_read_dirty. 2. use mutex for 'buff_used'. 3. before calling simple_read_from_buffer in seq_read_dirty, judge if the buffer changed since last read. If so, return -EFAULT. Signed-off-by: Nyu kuai <yukuai3@huawei.com> Signed-off-by: Nzhangyi (F) <yi.zhang@huawei.com> Signed-off-by: NDianfang Zhang <zhangdianfang@huawei.com> Acked-by: NXie XiuQi <xiexiuqi@huawei.com> Signed-off-by: NChen Jun <chenjun102@huawei.com>
Showing
想要评论请 注册 或 登录