From: Tetsuo Handa penguin-kernel@i-love.sakura.ne.jp
stable inclusion from stable-v4.19.198 commit cbd87ba6a13891acf6180783f8234a8b7a3e3d4d category: bugfix bugzilla: https://gitee.com/src-openeuler/kernel/issues/I9RUUX CVE: CVE-2021-47336
Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=...
--------------------------------
commit 49ec114a6e62d8d320037ce71c1aaf9650b3cafd upstream.
Oops, I failed to update subject line.
Commit 7ef4c19d245f3dc2 ("smackfs: restrict bytes count in smackfs write functions") missed that count > SMK_CIPSOMAX check applies to only format == SMK_FIXED24_FMT case.
Reported-by: syzbot syzbot+77c53db50c9fff774e8e@syzkaller.appspotmail.com Signed-off-by: Tetsuo Handa penguin-kernel@I-love.SAKURA.ne.jp Signed-off-by: Casey Schaufler casey@schaufler-ca.com Signed-off-by: Greg Kroah-Hartman gregkh@linuxfoundation.org Signed-off-by: Felix Fu fuzhen5@huawei.com --- security/smack/smackfs.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/security/smack/smackfs.c b/security/smack/smackfs.c index 115f790c3b12..9a04eb987be4 100644 --- a/security/smack/smackfs.c +++ b/security/smack/smackfs.c @@ -884,6 +884,8 @@ static ssize_t smk_set_cipso(struct file *file, const char __user *buf, if (format == SMK_FIXED24_FMT && (count < SMK_CIPSOMIN || count > SMK_CIPSOMAX)) return -EINVAL; + if (count > PAGE_SIZE) + return -EINVAL;
data = memdup_user_nul(buf, count); if (IS_ERR(data))
反馈: 您发送到kernel@openeuler.org的补丁/补丁集,已成功转换为PR! PR链接地址: https://gitee.com/openeuler/kernel/pulls/8611 邮件列表地址:https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/F...
FeedBack: The patch(es) which you have sent to kernel@openeuler.org mailing list has been converted to a pull request successfully! Pull request link: https://gitee.com/openeuler/kernel/pulls/8611 Mailing list address: https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/F...