From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Monjalon Subject: Re: [PATCH] vfio: don't needlessly setup devices in secondary process Date: Sun, 25 Nov 2018 13:03:46 +0100 Message-ID: <2986248.Quj79joPid@xps> References: <20181121184132.34039-1-dariusz.stojaczyk@intel.com> <902e9ebc-e658-fd41-55ce-8ba9e3a72728@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit Cc: dev@dpdk.org, "Burakov, Anatoly" To: Darek Stojaczyk Return-path: Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by dpdk.org (Postfix) with ESMTP id 93DAE1B616 for ; Sun, 25 Nov 2018 13:03:49 +0100 (CET) In-Reply-To: <902e9ebc-e658-fd41-55ce-8ba9e3a72728@intel.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 23/11/2018 10:12, Burakov, Anatoly: > On 21-Nov-18 6:41 PM, Darek Stojaczyk wrote: > > Setting up a device that wasn't setup in the primary > > process will possibly break the primary process. That's > > because the IPC message to retrieve the group fd in the > > primary will also *open* that group if it wasn't opened > > before. Even though the secondary process closes that fd > > soon after as a part of its error handling path, the > > primary process leaks it. > > > > What's worse, opening that fd on the primary will > > increment the process-local counter of opened groups. > > If it was 0 before, then the group will never be added > > to the vfio container, nor dpdk memory will be ever > > mapped. > > > > This patch moves the proper error checks earlier in the > > code to fuly prevent setting up devices in secondary > > processes that weren't setup in the primary process. > > > > Fixes: 2f4adfad0a69 ("vfio: add multiprocess support") > > Cc: anatoly.burakov@intel.com > > > > Signed-off-by: Darek Stojaczyk > > Acked-by: Anatoly Burakov Applied, thanks