Commit adb4b4d6 authored by Kele Huang's avatar Kele Huang Committed by Dongxu Sun
Browse files

ptp: fix error print of ptp_kvm on X86_64 platform

mainline inclusion
from mainline-v5.15-rc1
commit c2402d43
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I8DWT1
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=c2402d43d183b11445aed921e7bebcd47ef222f1



--------------------------------

Commit a86ed2cf ("ptp: Don't print an error if ptp_kvm is not supported")
fixes the error message print on ARM platform by only concerning about
the case that the error returned from kvm_arch_ptp_init() is not -EOPNOTSUPP.
Although the ARM platform returns -EOPNOTSUPP if ptp_kvm is not supported
while X86_64 platform returns -KVM_EOPNOTSUPP, both error codes share the
same value 95.

Actually kvm_arch_ptp_init() on X86_64 platform can return three kinds of
errors (-KVM_ENOSYS, -KVM_EOPNOTSUPP and -KVM_EFAULT). The problem is that
-KVM_EOPNOTSUPP is masked out and -KVM_EFAULT is ignored among them.
This patch fixes this by returning them to ptp_kvm_init() respectively.

Signed-off-by: default avatarKele Huang <huangkele@bytedance.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarDongxu Sun <sundongxu3@huawei.com>
parent 08c59156
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment