Message ID | 20190830001706.29309-6-sean.j.christopherson@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | x86/sgx: Fix lock ordering bug w/ EADD | expand |
diff --git a/arch/x86/kernel/cpu/sgx/ioctl.c b/arch/x86/kernel/cpu/sgx/ioctl.c index 3800281c5945..fffdf25ee3f9 100644 --- a/arch/x86/kernel/cpu/sgx/ioctl.c +++ b/arch/x86/kernel/cpu/sgx/ioctl.c @@ -349,6 +349,7 @@ static int __sgx_encl_extend(struct sgx_encl *encl, if (ret) { if (encls_failed(ret)) ENCLS_WARN(ret, "EEXTEND"); + sgx_encl_destroy(encl); return -EFAULT; } }
Mark an enclave as dead and release its resources if EEXTEND fails, as the driver cannot gracefully unwind from EEXTEND failure and does not provide userspace enough information to restart the ioctl. Allowing EEXTEND to be restarted is not a requirement as EEXTEND can only fail in the event of a kernel or hardware bug. Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com> --- arch/x86/kernel/cpu/sgx/ioctl.c | 1 + 1 file changed, 1 insertion(+)