Do not call set_page_dirty() unless the EWB operation is successful. Probably nothing bad will happen by doing this but it is still an unnecessary action. Cc: Sean Christopherson <sean.j.christopherson@xxxxxxxxx> Cc: Shay Katz-zamir <shay.katz-zamir@xxxxxxxxx> Cc: Serge Ayoun <serge.ayoun@xxxxxxxxx> Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@xxxxxxxxxxxxxxx> --- arch/x86/kernel/cpu/sgx/reclaim.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/cpu/sgx/reclaim.c b/arch/x86/kernel/cpu/sgx/reclaim.c index d82ce1eaa60e..213406756443 100644 --- a/arch/x86/kernel/cpu/sgx/reclaim.c +++ b/arch/x86/kernel/cpu/sgx/reclaim.c @@ -266,9 +266,12 @@ static int __sgx_encl_ewb(struct sgx_encl *encl, struct sgx_epc_page *epc_page, kunmap_atomic((void *)(unsigned long)(pginfo.metadata - pcmd_offset)); kunmap_atomic((void *)(unsigned long)pginfo.contents); - set_page_dirty(pcmd); + if (!ret) { + set_page_dirty(pcmd); + set_page_dirty(backing); + } + put_page(pcmd); - set_page_dirty(backing); err_pcmd: put_page(backing); -- 2.20.1