From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <dev-bounces@dpdk.org> Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1752DA0C55; Fri, 5 Nov 2021 14:16:33 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9358841134; Fri, 5 Nov 2021 14:16:32 +0100 (CET) Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) by mails.dpdk.org (Postfix) with ESMTP id 3C7CC40E5A; Fri, 5 Nov 2021 14:16:31 +0100 (CET) Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id A104A5C010E; Fri, 5 Nov 2021 09:16:30 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Fri, 05 Nov 2021 09:16:30 -0400 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=fm2; bh= GtiaPjW0YLiVNP+sbBfa/gqTK3RXtSBPB9mzSsD0nro=; b=tt984yYfXbb+t6C7 OTzZTR9aNGLaUTOeey5IEMSoQXX/jomMUlEbiNJJ3xujQdaCU0IP0k5RkrqoCjc6 JrzCZcYyjwJtdQGZ7X2moJOwjsIX/7DKEsNPo5aqKJELhCNXP08y6A2NaU0B4WIg 7Tk005qu0JMI7AMewsgbZaov0xx/HPoqrl4j0Ufj2y0WN1aHG6kkuwcrESj6tWSe DwgeO57+9vesf+aYX12xu60QadPVqz2q8PUMP17xxcrUzVjvkrElbQGTFGIFL0Oy p/lbZ78v4dVkG/1bwdegC7kkPqJz9OMDKBDgqaEtyCWyQyW1KEL69rKx1Mpfq78A Pd7bgw== 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=GtiaPjW0YLiVNP+sbBfa/gqTK3RXtSBPB9mzSsD0n ro=; b=LYPP6MiqDSlJi/UiH8jsoyCFWW3/OuGng4NEbmB6iPJTND7MylGeqpxSS O2t4K8NQSZYVKY4IxmyQPs27NDM+CKNecdHB23B15UaBmBxR2qLFuN6JuMJYRJOl rx+IXpDr2UWX51nlm1x4us4dhp+algcmIccu7Vgm/kECKwctdvRR3o+03X0Qx/A8 UWiCKMGUai/E5lsupBnwZHIKE5/V9jGRa6spGX9K8OeZYjH+t4NWJSr/2Y+lrafd Qp/bNJtgWaB6KO1tIV4/I2wAGFoOvtsCPy2mgNzou2Dd/okYZN4vVahb17YsAG0+ 1vXiqqB0ALVJb+B04Mv6xBq5KKjZw== X-ME-Sender: <xms:ri6FYZuLUnKgKhVh9DejWUnDUZYTSooT1rzPRZcvfv1vkqrrQMWwKw> <xme:ri6FYSfPbDuDWNr4dUB2WNPl6nFPlKehBU1sqDob_78J1YvCXQyr85kiFNJhQJr_j KOGPsBwNlkSkriS_g> X-ME-Received: <xmr:ri6FYcyVxdBknksY54aQIprpWMZ89GHptcDu-03KMJJAueQ9mS6H6X8Or8UDjVu7V1XbMR8l3dKuOzs0V1zn8Rkb9g> X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvuddrtdeigdegkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkjghfggfgtgesthfuredttddtvdenucfhrhhomhepvfhhohhmrghs ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucggtf frrghtthgvrhhnpedugefgvdefudfftdefgeelgffhueekgfffhfeujedtteeutdejueei iedvffegheenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpehthhhomhgrshesmhhonhhjrghlohhnrdhnvght X-ME-Proxy: <xmx:ri6FYQN8qa0hxVRksALaHae9YALNIbjyRtHgfApUV5tsE6L-nQvCsw> <xmx:ri6FYZ9DnF_IL85cEjVl_Dd921cS2qSEKM1NbIIS04v6YIwpNjZNcQ> <xmx:ri6FYQVBxNNa9x9iKHiaA4HlGYX46z8ntfO9zDCFVT_6aGWJH0iywQ> <xmx:ri6FYcmdcrR7IwWKocRnLNrYOEN57-Q9Eds2Rw9XqR4TtrCcTpmC2g> Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 5 Nov 2021 09:16:29 -0400 (EDT) From: Thomas Monjalon <thomas@monjalon.net> To: "Yigit, Ferruh" <ferruh.yigit@intel.com> Cc: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>, Stephen Hemminger <stephen@networkplumber.org>, dev@dpdk.org, "stable@dpdk.org" <stable@dpdk.org>, Matan Azrad <matan@nvidia.com>, "Xia, Chenbo" <chenbo.xia@intel.com> Date: Fri, 05 Nov 2021 14:16:27 +0100 Message-ID: <2458714.jUUgoNLaax@thomas> In-Reply-To: <SN6PR11MB350411A3AAE8079F23CCDF0E9C8E9@SN6PR11MB3504.namprd11.prod.outlook.com> References: <20211102234434.2639807-1-ferruh.yigit@intel.com> <20211104110422.2920154-1-ferruh.yigit@intel.com> <SN6PR11MB350411A3AAE8079F23CCDF0E9C8E9@SN6PR11MB3504.namprd11.prod.outlook.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [dpdk-dev] [dpdk-stable] [PATCH] ethdev: fix crash on owner delete X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions <dev.dpdk.org> List-Unsubscribe: <https://mails.dpdk.org/options/dev>, <mailto:dev-request@dpdk.org?subject=unsubscribe> List-Archive: <http://mails.dpdk.org/archives/dev/> List-Post: <mailto:dev@dpdk.org> List-Help: <mailto:dev-request@dpdk.org?subject=help> List-Subscribe: <https://mails.dpdk.org/listinfo/dev>, <mailto:dev-request@dpdk.org?subject=subscribe> Errors-To: dev-bounces@dpdk.org Sender: "dev" <dev-bounces@dpdk.org> 05/11/2021 04:03, Xia, Chenbo: > From: stable <stable-bounces@dpdk.org> On Behalf Of Ferruh Yigit > > > 'eth_dev->data' can be null before ethdev allocated. The API walks > > through all eth devices, at least for some data can be null. > > > > Adding 'eth_dev->data' null check before accessing it. > > > > Fixes: 33c73aae32e4 ("ethdev: allow ownership operations on unused port") > > Cc: stable@dpdk.org > > > > Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com> [...] > > @@ -757,10 +757,13 @@ rte_eth_dev_owner_delete(const uint64_t owner_id) > > rte_spinlock_lock(ð_dev_shared_data->ownership_lock); > > > > if (eth_is_valid_owner_id(owner_id)) { > > - for (port_id = 0; port_id < RTE_MAX_ETHPORTS; port_id++) > > - if (rte_eth_devices[port_id].data->owner.id == owner_id) > > - memset(&rte_eth_devices[port_id].data->owner, 0, > > + for (port_id = 0; port_id < RTE_MAX_ETHPORTS; port_id++) { > > + struct rte_eth_dev_data *data = > > + rte_eth_devices[port_id].data; > > + if (data != NULL && data->owner.id == owner_id) Indeed the NULL check was missing. > Acked-by: Chenbo Xia <chenbo.xia@intel.com> Acked-by: Thomas Monjalon <thomas@monjalon.net>