From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id CBE45A0C56; Fri, 5 Nov 2021 14:36:35 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B52C14113D; Fri, 5 Nov 2021 14:36:35 +0100 (CET) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id F0D1341134; Fri, 5 Nov 2021 14:36:34 +0100 (CET) Received: from [192.168.38.17] (aros.oktetlabs.ru [192.168.38.17]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by shelob.oktetlabs.ru (Postfix) with ESMTPSA id 6A5A67F53A; Fri, 5 Nov 2021 16:36:34 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru 6A5A67F53A DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=oktetlabs.ru; s=default; t=1636119394; bh=bYl3gBnUWUfPKbwfJMAF2iyiZzfNYfP0ZnCWn+qnNfk=; h=Subject:To:Cc:References:From:Date:In-Reply-To; b=B99Puuqb77nkE63063fta012W0UK4wDc0hTJTYNy4giyWXh49iPHMTi+a/CapOEOg nErTkNtO15UsQOeXwlD+4qmuI87y2rGBik3Te/PKIpEB2vQd0g6qkqdcew3SvjCML9 iYjACTvyC5wLRQeyzSmOoTqcWIrG4vAhkGPWTjag= To: Thomas Monjalon , "Yigit, Ferruh" Cc: Stephen Hemminger , dev@dpdk.org, "stable@dpdk.org" , Matan Azrad , "Xia, Chenbo" References: <20211102234434.2639807-1-ferruh.yigit@intel.com> <20211104110422.2920154-1-ferruh.yigit@intel.com> <2458714.jUUgoNLaax@thomas> From: Andrew Rybchenko Organization: OKTET Labs Message-ID: Date: Fri, 5 Nov 2021 16:36:34 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: <2458714.jUUgoNLaax@thomas> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 11/5/21 4:16 PM, Thomas Monjalon wrote: > 05/11/2021 04:03, Xia, Chenbo: >> From: stable 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 > [...] >>> @@ -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 > > Acked-by: Thomas Monjalon > Acked-by: Andrew Rybchenko