Commit 3a01d1b5 authored by Zheng Yejian's avatar Zheng Yejian Committed by Yang Yingliang
Browse files

sysfs: Remove address alignment constraint in sysfs_emit{_at}

hulk inclusion
category: bugfix
bugzilla: 51349
CVE: CVE-2021-27365
---------------------------

sysfs_emit and sysfs_emit_at have a constraint that output buffer should
be alignment with PAGE_SIZE, but currently we can not guarantee it since
59bb4798 ("mm, sl[aou]b: guarantee natural alignment for
kmalloc(power-of-two)") is not merged.

This may lead to an unexpected warning when execute like:
'cat /sys/class/iscsi_transport/tcp/handle'.

As for the necessity of the address alignment constraint, Joe Perches
(the code author) wrote that:
    > It's to make sure it's a PAGE_SIZE aligned buffer.
    > It's just so it would not be misused/abused in non-sysfs derived cases.

So we'll not need to introduce 59bb4798 ("mm, sl[aou]b: guarantee natural
alignment for kmalloc(power-of-two)") but just remove the address alignment
constraint.

For more discussions of the issue, see:
    https://www.spinics.net/lists/stable/msg455428.html



Signed-off-by: default avatarZheng Yejian <zhengyejian1@huawei.com>
Reviewed-by: default avatarzhangyi (F) <yi.zhang@huawei.com>
Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
Reviewed-by: default avatarZhang Yi <yi.zhang@huawei.com>
Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
parent 9ba54aa4
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment