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 C58414325F; Wed, 1 Nov 2023 11:48:53 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 98BA840151; Wed, 1 Nov 2023 11:48:53 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) by mails.dpdk.org (Postfix) with ESMTP id 9FEE4400EF; Wed, 1 Nov 2023 11:48:51 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1698835732; x=1730371732; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=QgFTEwcVEKN/DecQWeg3lvolNZnXInF31f5lxkqfCj8=; b=iVV/+VxY4ACqOXKCaAFK8ZMB5liog7QFdlYwf7Qe/96wO8Q7bwTDxQk1 /HwvU5NT0Zjw8t2qIKXHsjonhwnAh8JDpgDQ2rLCKz70zsERqvsH7wM81 4hn3O90wzWrpzf7dSgxIsWo5F/0BwnkgU/i9x2iv13gnVrO/XNzRMFMsb U3lLEmOAnSeIn7C8t+ObnB/tbQXWfNu1lnYHRTtqbnRFFbjaWWVni+v2M c8XvyIr24HJJcig2UIDkbkiAXyflCgP+PgsvZ0HA7vDaEkDbxxihyJX1R K6ls5nSwpWlYY08LRYmlsSJZ+VkMhBSsiGqjt9kWCjtBkBdHn6toSgywK A==; X-IronPort-AV: E=McAfee;i="6600,9927,10880"; a="1325943" X-IronPort-AV: E=Sophos;i="6.03,268,1694761200"; d="scan'208";a="1325943" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Nov 2023 03:48:51 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10880"; a="851540942" X-IronPort-AV: E=Sophos;i="6.03,268,1694761200"; d="scan'208";a="851540942" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by FMSMGA003.fm.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 01 Nov 2023 03:48:50 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34; Wed, 1 Nov 2023 03:48:49 -0700 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34 via Frontend Transport; Wed, 1 Nov 2023 03:48:49 -0700 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (104.47.73.41) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.34; Wed, 1 Nov 2023 03:48:49 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mInC734pfJwVRO6JzfvKFoo73RpMbobcS/sidX0y/0rkbWeotm7OBbs5bX2PdKAfrsJbrXAev7veCOTC383hH7KPtruXi7oTF6pXu0srbRVSs1xRbbPd4yxMLbApTu/U6LdMUB3/Hd2a5evKcfCnSLTE2diqs3tTaEEjXSe7dUOeR+bVGu5YBHTvC9H7EUGnx5zyQhG7P1JRB2D3uFg53VztuPXAHE45WIQG8YTDAFfRDcaQ5Fjj+OB/JEnIouy7YYCBnSmkBJWFS2DyBLUkGRNcaeunsT91HSQvQdFDW5ICTOR8G0e4RteuAGQH/QhnZxNbd4IL7/J3EZ2OXXozIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=JN42B3+OROjNfbvBhJZMk9vtGe4OJMazjgUvW/IwT88=; b=Nd5M0HKX3BsRlwx/GA3bm6Sjf/FwgP1GP/GslebLXjA6oBUmTATZSlPw/pN/h/svYfd+qqd/9eEQ1HRQKBb5QHjgTkmtdHNHpWWbbhwpQkDgUPA0FAWBjz4Eu80ULb1ONbZIFeFaryl5VHPPtP3dQeOI9XUmHQLsXcyBbJmx5mNzAhKmAeeCPUGEdorXLglrUVuEZVBpmm2RL63cTjC4tK3g+h4rubN9IfeussfD9EB6RbPM9YuDctNk27bTUpAAOdESOX0THtEVEQwlf2McY+6A+/lT/PlZXbJTjgHie63MQV2iL8Ykfz8Wv9C/fe9mj+/7IEPzuoFXDZothN0AxQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Received: from DM4PR11MB5994.namprd11.prod.outlook.com (2603:10b6:8:5d::20) by CH3PR11MB8468.namprd11.prod.outlook.com (2603:10b6:610:1ba::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.19; Wed, 1 Nov 2023 10:48:43 +0000 Received: from DM4PR11MB5994.namprd11.prod.outlook.com ([fe80::fccd:acb8:20c7:e756]) by DM4PR11MB5994.namprd11.prod.outlook.com ([fe80::fccd:acb8:20c7:e756%4]) with mapi id 15.20.6933.026; Wed, 1 Nov 2023 10:48:42 +0000 From: "Zhang, Qi Z" To: "Ye, MingjinX" , "dev@dpdk.org" CC: "Yang, Qiming" , "Zhou, YidingX" , "stable@dpdk.org" Subject: RE: [PATCH v3] net/ice: fix crash on closing representor ports Thread-Topic: [PATCH v3] net/ice: fix crash on closing representor ports Thread-Index: AQHaDK2H1trH7Yv6FU6MuR8ogk3T57BlRIuQ Date: Wed, 1 Nov 2023 10:48:42 +0000 Message-ID: References: <20231030084459.3470038-1-mingjinx.ye@intel.com> <20231101101347.3570418-1-mingjinx.ye@intel.com> In-Reply-To: <20231101101347.3570418-1-mingjinx.ye@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: DM4PR11MB5994:EE_|CH3PR11MB8468:EE_ x-ms-office365-filtering-correlation-id: 71a35a9a-66af-488f-7690-08dbdac81d4a x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: yMfI+4sLT2jLfliMMrXnexQIcseC81uPkkhKUsxG1r6jTI55T+H+S4WFpdmO+EHspeDqvhkaSHsQQUzEs61/05TnFXiULTzgCGLj4T8TUhzl6khfKuXjITyjTIEmIRyL/JGptziMsQXDSDgRDOv90+ttY1R5e5lo1McAWWQB8VVEMD3b1Si4gBquWoROmJsPKwhD36a+DpslWHU+fs0N33i0OE3cB5U6xtyfw6AmB6x+r2v74vNrEGjLF+R7HCQ/Vy3pBuFAza8GIKlnzJkUJt6uYiSYdKs/xZBVC7FBAKf4HMpivjWeK3bnr0xZnFoaXADhwzAvx0/nupfG1eUVbTjy5UQUSqDyPqZg8XQ7lnZiN46ERQtrWfl/eKHzt+MuHD57NMka2G12e+/UjZGl4Hfy7jtWdQz2NEqOT1GPv54BeLbzCoIwECe+8MY+RpzHls5Vfg/pwr1qIoxfBFS7tg8g6xB5VN4rzfPF0K7DO9v4JgGDtFrUf1ax4dq926i3Giet+vO5QAQhgRIfwKObicf8+spNU31wEFM6CZuoq1wEgFweYYn/WzcAuPbkv/aZjCkX5k/lNaf1FCky681v7u1sr8ST9df2g/FU442h4H2XfMyPanbYilVCRm1NMU3b x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR11MB5994.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(136003)(366004)(346002)(39860400002)(396003)(376002)(230922051799003)(451199024)(1800799009)(64100799003)(186009)(66446008)(66476007)(66556008)(64756008)(76116006)(110136005)(54906003)(66946007)(316002)(9686003)(6506007)(71200400001)(7696005)(53546011)(26005)(38070700009)(38100700002)(122000001)(83380400001)(33656002)(82960400001)(86362001)(478600001)(450100002)(8676002)(8936002)(5660300002)(52536014)(4326008)(41300700001)(2906002)(55016003); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?Erls8k4CIx4XyoUfEtk/4YJjAsh1C6Cz78JML6cyu7PojgutUxBwfwj+XP+b?= =?us-ascii?Q?R8QX2OqEKBoXGbG3psZJ0Hk+yVAtBrXMnBQoKLFga5123fvHlNagQXOyElRA?= =?us-ascii?Q?nzq67DGy7dzu1k7qwcnw7WkkMYlfVZNp2+mVcT9H24JxXMy2Jo8KhuiRdm2/?= =?us-ascii?Q?R7UtDWKnYDRDsfQ2STONXYPBDje9sQ+4erzbPRFoXOd528ZzFlHN/7U+ph4b?= =?us-ascii?Q?GK/Zh8h1anVZR8N/si5+pgkMK6a0mEdmJOUyvobspcgpo3AUwC13IgDKZLY/?= =?us-ascii?Q?mP+80vZ/7H8w2qkBvm/iuaq5WNnQWIxrjE6CLSauFolaOBhkWP+7DsuoNc0Q?= =?us-ascii?Q?m/mm501a8tVjqC8LCSj0hFxTgg3pnVSZ6Q84025US6VkRTDwVrYhk2lJyc1K?= =?us-ascii?Q?JvQ8CJ3Kq5OUtqooGNipufOg87+yggHP8TJ24q0R2wYZP/WrIDwA/75/13DN?= =?us-ascii?Q?W6jjWbdTT1Lb/JYMedWfoEdqH7FrnWQzHCkI7I6PBIa2pwlwsTnts9Ty8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r+ag5F9O1wVe29tEGYyJQhk3HKkXllafh+eL?= =?us-ascii?Q?1KCoqD2Myyw8pEvR+RIHpzinnTp7vvQXGm4c01RCw80Vqb73juwaZSdvtbrN?= =?us-ascii?Q?IXiuM+h5DvdeTDKC6U5uQbVeA1nFAAHSXI6V79BHa86zPrVHRa0hp8pKffhy?= =?us-ascii?Q?1/bmIkUByIF8uEe/H1MqNADjX+48jfhbtc0sxp6F?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5994.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 71a35a9a-66af-488f-7690-08dbdac81d4a X-MS-Exchange-CrossTenant-originalarrivaltime: 01 Nov 2023 10:48:42.2220 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 6gn6mfN4eKtPiz2qQgvgbdBywXtp8nYRV+mJHrIsj32m7aWgbNghkM/nhR3uDrTt2jxzGrbjn8RudTTCbhXLAA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR11MB8468 X-OriginatorOrg: intel.com 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 > -----Original Message----- > From: Ye, MingjinX > Sent: Wednesday, November 1, 2023 6:14 PM > To: dev@dpdk.org > Cc: Yang, Qiming ; Zhou, YidingX > ; Ye, MingjinX ; > stable@dpdk.org; Zhang, Qi Z > Subject: [PATCH v3] net/ice: fix crash on closing representor ports >=20 > The data resource in struct rte_eth_dev is cleared and points to NULL whe= n > the DCF port is closed. >=20 > If the DCF representor port is closed after the DCF port is closed, a > segmentation fault occurs because the representor port accesses the data > resource released by the DCF port. >=20 > This patch checks if the resource is present before accessing. >=20 > Fixes: 5674465a32c8 ("net/ice: add DCF VLAN handling") > Fixes: da9cdcd1f372 ("net/ice: fix crash on representor port closing") > Cc: stable@dpdk.org >=20 > Signed-off-by: Mingjin Ye > --- > v3: New solution. > --- > drivers/net/ice/ice_dcf_vf_representor.c | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) >=20 > diff --git a/drivers/net/ice/ice_dcf_vf_representor.c > b/drivers/net/ice/ice_dcf_vf_representor.c > index b9fcfc80ad..8c45e28f02 100644 > --- a/drivers/net/ice/ice_dcf_vf_representor.c > +++ b/drivers/net/ice/ice_dcf_vf_representor.c > @@ -111,14 +111,16 @@ ice_dcf_vf_repr_link_update(__rte_unused struct > rte_eth_dev *ethdev, static __rte_always_inline struct ice_dcf_hw * > ice_dcf_vf_repr_hw(struct ice_dcf_vf_repr *repr) { > - struct ice_dcf_adapter *dcf_adapter =3D > - repr->dcf_eth_dev->data->dev_private; > + struct rte_eth_dev_data *dcf_data =3D repr->dcf_eth_dev->data; Seems this expose another issue, if dcf port already be closed, the dcf_eth= _dev instance could already be reused by another driver. So we can't assume dcf_eth_dev->data is NULL, I think you can refine based= on v2's method, but don't update dcf_valid flag in representor port's dev_= stop. > + struct ice_dcf_adapter *dcf_adapter; >=20 > - if (!dcf_adapter) { > + if (!dcf_data || !dcf_data->dev_private) { > PMD_DRV_LOG(ERR, "DCF for VF representor has been > released\n"); > return NULL; > } >=20 > + dcf_adapter =3D dcf_data->dev_private; > + > return &dcf_adapter->real_hw; > } >=20 > -- > 2.25.1