+25
−0
Loading
mainline inclusion from mainline-v6.9 commit 6309863b31dd80317cd7d6824820b44e254e2a9c category: bugfix bugzilla: https://gitee.com/src-openeuler/kernel/issues/I9U9YN CVE: CVE-2024-36915 Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=6309863b31dd80317cd7d6824820b44e254e2a9c -------------------------------- copy_from_sockptr() helper is unsafe, unless callers did the prior check against user provided optlen. Too many callers get this wrong, lets add a helper to fix them and avoid future copy/paste bugs. Instead of : if (optlen < sizeof(opt)) { err = -EINVAL; break; } if (copy_from_sockptr(&opt, optval, sizeof(opt)) { err = -EFAULT; break; } Use : err = copy_safe_from_sockptr(&opt, sizeof(opt), optval, optlen); if (err) break; Conflicts: include/linux/sockptr.h [There are only context conficts, no code logic conflicts] Signed-off-by:Eric Dumazet <edumazet@google.com> Link: https://lore.kernel.org/r/20240408082845.3957374-2-edumazet@google.com Signed-off-by:
Jakub Kicinski <kuba@kernel.org> Signed-off-by:
Wang Wensheng <wangwensheng4@huawei.com> Signed-off-by:
Yongqiang Liu <liuyongqiang13@huawei.com>