From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id B428F293B; Fri, 26 Oct 2018 16:04:30 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Oct 2018 07:04:29 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,428,1534834800"; d="scan'208";a="81133466" Received: from aburakov-mobl1.ger.corp.intel.com (HELO [10.252.8.177]) ([10.252.8.177]) by fmsmga007.fm.intel.com with ESMTP; 26 Oct 2018 07:04:28 -0700 To: Darek Stojaczyk , dev@dpdk.org Cc: jianfeng.tan@intel.com, stable@dpdk.org References: <20181025104911.137496-1-dariusz.stojaczyk@intel.com> From: "Burakov, Anatoly" Message-ID: Date: Fri, 26 Oct 2018 15:04:27 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20181025104911.137496-1-dariusz.stojaczyk@intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH] vfio: fix read-after-free on getting container fd X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Oct 2018 14:04:31 -0000 On 25-Oct-18 11:49 AM, Darek Stojaczyk wrote: > We were reading some memory just after freeing it. > > Fixes: 83a73c5fef66 ("vfio: use generic multi-process channel") > Cc: jianfeng.tan@intel.com > Cc: anatoly.burakov@intel.com > Cc: stable@dpdk.org > > Signed-off-by: Darek Stojaczyk > --- > lib/librte_eal/linuxapp/eal/eal_vfio.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/lib/librte_eal/linuxapp/eal/eal_vfio.c b/lib/librte_eal/linuxapp/eal/eal_vfio.c > index d7268e4ce..fc3c7b870 100644 > --- a/lib/librte_eal/linuxapp/eal/eal_vfio.c > +++ b/lib/librte_eal/linuxapp/eal/eal_vfio.c > @@ -1034,8 +1034,9 @@ rte_vfio_get_container_fd(void) > mp_rep = &mp_reply.msgs[0]; > p = (struct vfio_mp_param *)mp_rep->param; > if (p->result == SOCKET_OK && mp_rep->num_fds == 1) { > + vfio_container_fd = mp_rep->fds[0]; > free(mp_reply.msgs); > - return mp_rep->fds[0]; > + return vfio_container_fd; > } > free(mp_reply.msgs); > } > Acked-by: Anatoly Burakov -- Thanks, Anatoly