From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60051.outbound.protection.outlook.com [40.107.6.51]) by dpdk.org (Postfix) with ESMTP id 9FBE07CB0 for ; Thu, 20 Dec 2018 01:22:29 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=YT79X6+k7thEppVCUOLmu3Srxc7pQudGOgpV1A0Mo4M=; b=q1HA3fy9Rmq+g/sCk414SNxrMYtSYL5eIkeWSvz0rV6DfR/7QG+mCLVVPJSlKdC39Inxev1kiFJK4bUnkGj/iGJ6o8e9NuzojdQ5oBqupeKChXGjH6MM3Cu4Ddm7v55CvgcpIKwPabWc2I2bm12hKiWQvpuVB2pUMiipAsEn7SY= Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com (52.134.72.27) by DB3PR0502MB4074.eurprd05.prod.outlook.com (52.134.72.155) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1425.20; Thu, 20 Dec 2018 00:22:28 +0000 Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com ([fe80::d43a:3775:8af7:29c6]) by DB3PR0502MB3980.eurprd05.prod.outlook.com ([fe80::d43a:3775:8af7:29c6%3]) with mapi id 15.20.1425.025; Thu, 20 Dec 2018 00:22:28 +0000 From: Yongseok Koh To: Darek Stojaczyk CC: Maxime Coquelin , Thomas Monjalon , dpdk stable Thread-Topic: [dpdk-stable] patch 'eal: fix devargs reference after probing failure' has been queued to LTS release 17.11.5 Thread-Index: AQHUiDmI6BsFlvRa2EGX7URldbUpfaWG47mA Date: Thu, 20 Dec 2018 00:22:28 +0000 Message-ID: <90C077B1-BB06-4D23-BA1B-33A3F99D1CD1@mellanox.com> References: <20181129231202.30436-1-yskoh@mellanox.com> <20181129231202.30436-128-yskoh@mellanox.com> In-Reply-To: <20181129231202.30436-128-yskoh@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=yskoh@mellanox.com; x-originating-ip: [69.181.245.183] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DB3PR0502MB4074; 6:HzkFhVwsU9RlTIlxI0GNuenjVR1jYFwrK127//vpnQdYtOqCKpRpVMU1I4aTHxtnOYBxGMaR6GvT/oIyxoz0od/+RNeFad5BmRwZx8/tTu+d7udNlGlUTUyTItpHehC0NVBD2AIpIiveyOznbTjuvaUSty/AjM51W/Ce9nhi8cZ9FViBMFCNptNffpsz/usDGpJgybcuNYDCy//ZZ/MJvHHeh8amWaIVoiqck3+WO5iz/eQ6F30oZOF6+T5qx3c5otNaOHfiv1vqwjvmuWZG8AaSp8qFxv3Yh9c5lvQ+wfgnWpP5E23S1hvsR98xib2WclTAlknxYoN9nmac7DaAuVUTBcoyBeUhDm37u0xeB2Qnwz48WcaSU7q4aPPB30VdnXWEyxZt5ztp9amO4tq94KrcCB0ZLV2+N/3GDNh3MjbONfz3TuvIhZOIMWO1SCB9cT9AqdXamoukPKEdssjxVQ==; 5:PlCveJA9kjFgHuHp+TKZn5fFq6pd3irUaJscPg+GrOrlBsrDFsq+UATIf/1JVGDpjPmSpoRZ0/8Snmx0C/+LxOr58h+4z1nh15byx68n5WRgSJ0JXDlnFjTaUpnTuziK3QHanJyaR1ymDY58EGzeDzzhaMZ5pKdS99jf/VEu4AE=; 7:QGWOY3SMM6/2zShB2y8s5dzSasA+AktNwxkyS/MypdE9apxZj4Qa62GaEHJZRAaq83OTTUp9n4fJoihLq+CpYZrqEn7qveBkhkGEF+dErUjWzwp79F4hSWRAD1IDOz/l6q+f/ragDHkIQQmoprnXNQ== x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-correlation-id: e9a006b5-0224-4a57-1605-08d6661139ad x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:DB3PR0502MB4074; x-ms-traffictypediagnostic: DB3PR0502MB4074: x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(3230021)(999002)(5005026)(6040522)(2401047)(8121501046)(93006095)(93001095)(3231475)(944501520)(4982022)(52105112)(10201501046)(3002001)(6055026)(149066)(150057)(6041310)(20161123562045)(20161123558120)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051)(76991095); SRVR:DB3PR0502MB4074; BCL:0; PCL:0; RULEID:; SRVR:DB3PR0502MB4074; x-forefront-prvs: 0892FA9A88 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(39860400002)(346002)(396003)(366004)(376002)(136003)(69234005)(199004)(189003)(28163001)(6436002)(82746002)(81166006)(81156014)(186003)(256004)(2616005)(486006)(476003)(305945005)(446003)(7736002)(5660300001)(33656002)(11346002)(53546011)(6506007)(97736004)(99286004)(5024004)(14444005)(106356001)(76176011)(105586002)(26005)(102836004)(6246003)(4001150100001)(6916009)(316002)(3846002)(6512007)(2906002)(54906003)(6116002)(229853002)(45080400002)(14454004)(68736007)(53936002)(4326008)(71200400001)(6486002)(86362001)(8936002)(83716004)(71190400001)(66066001)(575784001)(36756003)(478600001)(966005)(6306002)(25786009); DIR:OUT; SFP:1101; SCL:1; SRVR:DB3PR0502MB4074; H:DB3PR0502MB3980.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: RtjNUiiZ2Q2JaF0xLTulb+8O/29W5+50N1xhL68hoXiR9PkYBDTUTDLB/D8KeA75O/Uj5FwPuqdPJ41SoegXxy17rOG9Xl2qMi67nw/8ruyK3U4cj7dsD0gISzOrbeZl6tLcM+tR69xdJCfLB6wCFtnLsV/kOcuDJdB7tx3D+hIpbJChU1/UgcRZTGrExlrOeGL/RXPNn5Xo5h+/6mtBQEcrgG6PFsaUZn/n4pa2q24lI9Nd3rm9Q/+mbp0XZOaT5rt1+cuBAwK4xJfwmigIpzAm5HdFyKr++5SjNVtZDfxZmr8LCFtSieyIXi8lxG15 spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-ID: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: e9a006b5-0224-4a57-1605-08d6661139ad X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Dec 2018 00:22:28.6844 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR0502MB4074 Subject: Re: [dpdk-stable] patch 'eal: fix devargs reference after probing failure' has been queued to LTS release 17.11.5 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Dec 2018 00:22:29 -0000 Hi, This patch is being removed from stable/17.11 as it was mistakenly merged. Patches having 'fix' keyword in the title were merged even though those don= 't have "Cc: stable@dpdk.org" tag in the commit message. If you think this patch is still needed for stable/17.11, please let me kno= w. Then I'll take it back. Thanks, Yongseok > On Nov 29, 2018, at 3:12 PM, Yongseok Koh wrote: >=20 > Hi, >=20 > FYI, your patch has been queued to LTS release 17.11.5 >=20 > Note it hasn't been pushed to https://emea01.safelinks.protection.outlook= .com/?url=3Dhttp%3A%2F%2Fdpdk.org%2Fbrowse%2Fdpdk-stable&data=3D02%7C01= %7Cyskoh%40mellanox.com%7Cdc933a8b74424a5630d408d65650aa3a%7Ca652971c7d2e4d= 9ba6a4d149256f461b%7C0%7C0%7C636791301781669112&sdata=3DLnFDOibDoeFtUuq= nCBRLFqXaUWSZMw56A0NVOzq9TWs%3D&reserved=3D0 yet. > It will be pushed if I get no objections before 12/01/18. So please > shout if anyone has objections. >=20 > Also note that after the patch there's a diff of the upstream commit vs t= he patch applied > to the branch. If the code is different (ie: not only metadata diffs), du= e for example to > a change in context or macro names, please double check it. >=20 > Thanks. >=20 > Yongseok >=20 > --- > From abdb0f9a8b0fe291ef411fff1a44d0f1d49a40f6 Mon Sep 17 00:00:00 2001 > From: Darek Stojaczyk > Date: Fri, 23 Nov 2018 16:43:28 +0100 > Subject: [PATCH] eal: fix devargs reference after probing failure >=20 > [ upstream commit 161419983da296f329039e15b88e11ea31b15702 ] >=20 > 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. >=20 > 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 >=20 > 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. >=20 > 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. >=20 > Fixes: 7e8b26650146 ("eal: fix hotplug add / remove") >=20 > Signed-off-by: Darek Stojaczyk > Acked-by: Maxime Coquelin > Acked-by: Thomas Monjalon > --- > lib/librte_eal/common/eal_common_dev.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) >=20 > diff --git a/lib/librte_eal/common/eal_common_dev.c b/lib/librte_eal/comm= on/eal_common_dev.c > index dda8f5835..582cf3a31 100644 > --- a/lib/librte_eal/common/eal_common_dev.c > +++ b/lib/librte_eal/common/eal_common_dev.c > @@ -183,12 +183,16 @@ int rte_eal_hotplug_add(const char *busname, const = char *devname, > ret =3D -ENODEV; > goto err_devarg; > } > + /* Since there is a matching device, it is now its responsibility > + * to manage the devargs we've just inserted. From this point > + * those devargs shouldn't be removed manually anymore. > + */ >=20 > ret =3D bus->plug(dev); > if (ret) { > RTE_LOG(ERR, EAL, "Driver cannot attach the device (%s)\n", > dev->name); > - goto err_devarg; > + return ret; > } > free(name); > return 0; > --=20 > 2.11.0 >=20 > --- > Diff of the applied patch vs upstream commit (please double-check if non= -empty: > --- > --- - 2018-11-29 15:01:50.787743434 -0800 > +++ 0128-eal-fix-devargs-reference-after-probing-failure.patch 2018-11-29= 15:01:45.337956000 -0800 > @@ -1,8 +1,10 @@ > -From 161419983da296f329039e15b88e11ea31b15702 Mon Sep 17 00:00:00 2001 > +From abdb0f9a8b0fe291ef411fff1a44d0f1d49a40f6 Mon Sep 17 00:00:00 2001 > From: Darek Stojaczyk > Date: Fri, 23 Nov 2018 16:43:28 +0100 > Subject: [PATCH] eal: fix devargs reference after probing failure >=20 > +[ upstream commit 161419983da296f329039e15b88e11ea31b15702 ] > + > 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 > @@ -41,10 +43,10 @@ > 1 file changed, 5 insertions(+), 1 deletion(-) >=20 > diff --git a/lib/librte_eal/common/eal_common_dev.c b/lib/librte_eal/comm= on/eal_common_dev.c > -index a08dc085f..fd7f5ca7d 100644 > +index dda8f5835..582cf3a31 100644 > --- a/lib/librte_eal/common/eal_common_dev.c > +++ b/lib/librte_eal/common/eal_common_dev.c > -@@ -166,12 +166,16 @@ local_dev_probe(const char *devargs, struct rte_de= vice **new_dev) > +@@ -183,12 +183,16 @@ int rte_eal_hotplug_add(const char *busname, const= char *devname, > ret =3D -ENODEV; > goto err_devarg; > } > @@ -53,15 +55,15 @@ > + * those devargs shouldn't be removed manually anymore. > + */ >=20 > - ret =3D dev->bus->plug(dev); > - if (ret && !rte_dev_is_probed(dev)) { /* if hasn't ever succeeded */ > + ret =3D bus->plug(dev); > + if (ret) { > RTE_LOG(ERR, EAL, "Driver cannot attach the device (%s)\n", > dev->name); > - goto err_devarg; > + return ret; > } > -=20 > - *new_dev =3D dev; > + free(name); > + return 0; > --=20 > 2.11.0 >=20