hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/release-management/issues/ID5CMS -------------------------------- Originally, xcall_enable could only be set to 1 when it was disabled, or cleared to 0 when it was enabled, now the semantic has changed and causing abnormalities in DT testing, therefore add a check before modifying it. Fixes: fd83d0fe16f1 ("xcall: Rework the early exception vector of XCALL and SYNC") Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com> --- fs/proc/proc_xcall.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/fs/proc/proc_xcall.c b/fs/proc/proc_xcall.c index 8f7375235803..b57d84c281a3 100644 --- a/fs/proc/proc_xcall.c +++ b/fs/proc/proc_xcall.c @@ -66,6 +66,7 @@ static ssize_t xcall_write(struct file *file, const char __user *ubuf, { unsigned int sc_no = __NR_syscalls; struct task_struct *p; + int is_clear = 0; char buf[5]; int ret = 0; @@ -82,7 +83,8 @@ static ssize_t xcall_write(struct file *file, const char __user *ubuf, goto out; } - if (kstrtouint((buf + (int)(buf[0] == '!')), 10, &sc_no)) { + is_clear = (buf[0] == '!'); + if (kstrtouint((buf + is_clear), 10, &sc_no)) { ret = -EINVAL; goto out; } @@ -92,9 +94,12 @@ static ssize_t xcall_write(struct file *file, const char __user *ubuf, goto out; } - (TASK_XINFO(p))->xcall_enable[sc_no] = (int)(buf[0] != '!'); - ret = 0; - + if (!is_clear && !(TASK_XINFO(p))->xcall_enable[sc_no]) + (TASK_XINFO(p))->xcall_enable[sc_no] = 1; + else if (is_clear && (TASK_XINFO(p))->xcall_enable[sc_no]) + (TASK_XINFO(p))->xcall_enable[sc_no] = 0; + else + ret = -EINVAL; out: put_task_struct(p); -- 2.34.1