From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964985AbdKPN6A (ORCPT ); Thu, 16 Nov 2017 08:58:00 -0500 Received: from mga04.intel.com ([192.55.52.120]:21943 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964978AbdKPN5s (ORCPT ); Thu, 16 Nov 2017 08:57:48 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,398,1505804400"; d="scan'208";a="173748667" Date: Wed, 15 Nov 2017 12:04:16 +0200 From: Jarkko Sakkinen To: James Morris Cc: intel-sgx-kernel-dev@lists.01.org, platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v5 06/11] intel_sgx: driver for Intel Software Guard Extensions Message-ID: <20171115100416.n27fziiygtmu4d7r@linux.intel.com> References: <20171113194528.28557-1-jarkko.sakkinen@linux.intel.com> <20171113194528.28557-7-jarkko.sakkinen@linux.intel.com> <20171114201225.d2hum3njmduiupib@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171114201225.d2hum3njmduiupib@linux.intel.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: NeoMutt/20170609 (1.8.3) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 14, 2017 at 10:12:25PM +0200, Jarkko Sakkinen wrote: > On Tue, Nov 14, 2017 at 10:41:50AM +1100, James Morris wrote: > > > + if (IS_ERR(secs_epc)) { > > > + ret = PTR_ERR(secs_epc); > > > + goto out; > > > + } > > > > > +out: > > > + if (encl) > > > + kref_put(&encl->refcount, sgx_encl_release); > > > + return ret; > > > +} > > > > Don't you need an sgx_free_page() somewhere here? > > It will get freed by sgx_encl_release(). The call flow was somewhat messy so I just moved sgx_encl_alloc() call outside of sgx_encl_create(). /Jarkko