From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by dpdk.org (Postfix) with ESMTP id 3B46D1B453 for ; Sun, 25 Nov 2018 13:46:39 +0100 (CET) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id CD64F219FE; Sun, 25 Nov 2018 07:46:38 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Sun, 25 Nov 2018 07:46:38 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s=mesmtp; bh=yhul4xNlHdss7Jxtg8o1LmMhWp/pvXwDy27+2GDoG/g=; b=bi1ireR2dOgA 6vOXhyF5dDb9w+aLKsezRHHENZ0U/PChubpLIJXeSRi/fEwOWJSA/+pxQmOttZ7Q G4A5e0QFgN6iwCgt3nYq4xD1Khso5Rk3ZXOOjaXNifjgiAwKKu7zo9hwiIs3oqEj wZn4lhSwse2Y2xlUNAlEeKr4SULYgH4= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=yhul4xNlHdss7Jxtg8o1LmMhWp/pvXwDy27+2GDoG /g=; b=KD6hlKsbHT41hczEi29yr+zrD9ebKCtOMN19lUszD3VRPEB5UB7OOAMzQ vQmbjOkSYeNkseoFDzGm1VaNpC0EaBLjqL4A2askFah0QPgB1jm2t2J1NT6rd/yy h41Y1/qcx5YX66D+/wNp1ad8KzhTfCKE1PSG1yJk6ADyKpi4nzOWgsByNyZok6Zq 3bfUJr3anOa2YMSTnWt1lKPpRAn1J/1Y3zceL3qj3QENRQIoLaMR1G5VSnq7qmeO Pz0DrnHdfIyc34lKwC3fY/ASbrSCKIOMtQ050HAWxV0ps9OkXGqFJU1D+by4tn7P yYpj+TLk0MdQDkZKGDs7TEf1c5anw== X-ME-Sender: X-ME-Proxy: Received: from xps.localnet (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id 6AD25102DE; Sun, 25 Nov 2018 07:46:37 -0500 (EST) From: Thomas Monjalon To: Darek Stojaczyk Cc: dev@dpdk.org, Maxime Coquelin , gaetan.rivet@6wind.com Date: Sun, 25 Nov 2018 13:46:36 +0100 Message-ID: <3623854.KDShfdj67N@xps> In-Reply-To: References: <20181121193827.62540-1-dariusz.stojaczyk@intel.com> <20181123154328.97021-1-dariusz.stojaczyk@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [dpdk-dev] [PATCH v3] dev: don't remove devargs that are still referenced 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: Sun, 25 Nov 2018 12:46:39 -0000 23/11/2018 18:04, Maxime Coquelin: > Hi, > > On 11/23/18 4:43 PM, Darek Stojaczyk wrote: > > Even if a device failed to plug, it's still a device > > object that references the devargs. Those devargs will > > be freed automatically together with the device, but > > freeing them any earlier - like it's done in the hotplug > > error handling path right now - will give us a dangling > > pointer and a segfault scenario. > > > > Consider the following case: > > * secondary process receives the hotplug request IPC message > > * devargs are either created or updated > > * the bus is scanned > > * a new device object is created with the latest devargs > > * the device can't be plugged for whatever reason, > > bus->plug returns error > > * the devargs are freed, even though they're still referenced > > by the device object on the bus > > > > For PCI devices, the generic device name comes from > > a buffer within the devargs. Freeing those will make > > EAL segfault whenever the device name is checked. > > > > This patch just prevents the hotplug error handling > > path from removing the devargs when there's a device > > that references them. This is done by simply exiting > > early from the hotplug function. As mentioned in the > > beginning, those devargs will be freed later, together > > with the device itself. > > > > Fixes: 7e8b26650146 ("eal: fix hotplug add / remove") > > Should you also cc stable? > Above commit is in since v17.08. > > > Cc: gaetan.rivet@6wind.com > > Cc: thomas@monjalon.net > > > > Signed-off-by: Darek Stojaczyk > Acked-by: Maxime Coquelin Acked-by: Thomas Monjalon Applied (with rebase), thanks