x86/sgx: Return -ERESTARTSYS in sgx_ioc_enclave_add_pages()
authorJarkko Sakkinen <jarkko@kernel.org>
Wed, 18 Nov 2020 21:39:32 +0000 (23:39 +0200)
committerBorislav Petkov <bp@suse.de>
Thu, 19 Nov 2020 09:51:24 +0000 (10:51 +0100)
Return -ERESTARTSYS instead of -EINTR in sgx_ioc_enclave_add_pages()
when interrupted before any pages have been processed. At this point
ioctl can be obviously safely restarted.

Reported-by: Haitao Huang <haitao.huang@intel.com>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Borislav Petkov <bp@suse.de>
Link: https://lkml.kernel.org/r/20201118213932.63341-1-jarkko@kernel.org
arch/x86/kernel/cpu/sgx/ioctl.c

index 6d37117..30aefc9 100644 (file)
@@ -444,7 +444,7 @@ static long sgx_ioc_enclave_add_pages(struct sgx_encl *encl, void __user *arg)
        for (c = 0 ; c < add_arg.length; c += PAGE_SIZE) {
                if (signal_pending(current)) {
                        if (!c)
-                               ret = -EINTR;
+                               ret = -ERESTARTSYS;
 
                        break;
                }